authorize: reduce log noise for empty jwt (#793)

This commit is contained in:
Caleb Doxsey 2020-05-27 15:34:15 -06:00 committed by GitHub
parent 748ab836b6
commit b16bc5e090
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -23,7 +23,6 @@ func (a *Authorize) okResponse(
rawSession []byte,
isNewSession bool,
) *envoy_service_auth_v2.CheckResponse {
requestHeaders, err := a.getEnvoyRequestHeaders(rawSession, isNewSession)
if err != nil {
log.Warn().Err(err).Msg("authorize: error generating new request headers")

View file

@ -77,6 +77,10 @@ func getJWTSetCookieHeaders(cookieStore sessions.SessionStore, rawjwt []byte) (m
}
func getJWTClaimHeaders(options config.Options, encoder encoding.MarshalUnmarshaler, rawjwt []byte) (map[string]string, error) {
if len(rawjwt) == 0 {
return make(map[string]string), nil
}
var claims map[string]jwtClaim
err := encoder.Unmarshal(rawjwt, &claims)
if err != nil {