MCPcopy
hub / github.com/vouch/vouch-proxy / compressAndEncodeTokenString

Function compressAndEncodeTokenString

pkg/jwtmanager/jwtmanager.go:209–223  ·  view source on GitHub ↗
(ss string)

Source from the content-addressed store, hash-verified

207}
208
209func compressAndEncodeTokenString(ss string) (string, error) {
210 var buf bytes.Buffer
211 zw := gzip.NewWriter(&buf)
212 if _, err := zw.Write([]byte(ss)); err != nil {
213 return "", err
214 }
215 if err := zw.Close(); err != nil {
216 return "", err
217 }
218
219 ret := base64.URLEncoding.EncodeToString(buf.Bytes())
220 // ret := url.QueryEscape(buf.String())
221 log.Debugf("token compressed: was %d bytes, now %d", len(ss), len(ret))
222 return ret, nil
223}
224
225// FindJWT look for JWT in Cookie, JWT Header, Authorization Header (OAuth2 Bearer Token)
226// and Query String in that order

Callers 1

NewVPJWTFunction · 0.85

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected