Skip to content

Commit

Permalink
Remove "Authorization" as Accepted Headers on CORS, small fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Bernd Eckstein <[email protected]>
  • Loading branch information
HEllRZA committed Oct 5, 2020
1 parent b6e297b commit 46c6d9d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion server/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,6 @@ func (s *Server) calculateCodeChallenge(codeVerifier, codeChallengeMethod string
shaSum := sha256.Sum256([]byte(codeVerifier))
return base64.RawURLEncoding.EncodeToString(shaSum[:]), nil
default:
s.logger.Errorf("unknown challenge method (%v)", codeChallengeMethod)
return "", fmt.Errorf("unknown challenge method (%v)", codeChallengeMethod)
}
}
Expand Down Expand Up @@ -813,6 +812,7 @@ func (s *Server) handleAuthCode(w http.ResponseWriter, r *http.Request, client s
if providedCodeVerifier != "" && codeChallengeFromStorage != "" {
calculatedCodeChallenge, err := s.calculateCodeChallenge(providedCodeVerifier, authCode.PKCE.CodeChallengeMethod)
if err != nil {
s.logger.Error(err)
s.tokenErrHelper(w, errServerError, "", http.StatusInternalServerError)
return
}
Expand Down
3 changes: 1 addition & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,7 @@ func newServer(ctx context.Context, c Config, rotationStrategy rotationStrategy)
var handler http.Handler = h
if len(c.AllowedOrigins) > 0 {
corsOption := handlers.AllowedOrigins(c.AllowedOrigins)
corsHeaders := handlers.AllowedHeaders([]string{"Authorization"})
handler = handlers.CORS(corsOption, corsHeaders)(handler)
handler = handlers.CORS(corsOption)(handler)
}
r.Handle(path.Join(issuerURL.Path, p), instrumentHandlerCounter(p, handler))
}
Expand Down

0 comments on commit 46c6d9d

Please sign in to comment.