Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial attempt to enable JWT auth to look at a configurable header i… #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

martyn-meister
Copy link

…nstead of Authorization

Description

Motivation and Context

How Has This Been Tested?

Checklist:

  • My change requires a change to the documentation or CHANGELOG.
  • I have updated the documentation/CHANGELOG accordingly.
  • I have created a feature (non-master) branch for my PR.

@@ -60,7 +62,11 @@ func (j *jwtSessionLoader) loadSession(next http.Handler) http.Handler {
// getJwtSession loads a session based on a JWT token in the authorization header.
// (see the config options skip-jwt-bearer-tokens and extra-jwt-issuers)
func (j *jwtSessionLoader) getJwtSession(req *http.Request) (*sessionsapi.SessionState, error) {
auth := req.Header.Get("Authorization")
authHeader := "Authorization"
if j.jwtAuthHeader == "" {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever use the header from the config in this code (:warning: I have no Go knowledge whatsoever…)

I would assume something like this instead.

	authHeader := "Authorization"
	if j.jwtAuthHeader != nil && len(strings.TrimSpace(j.jwtAuthHeader)) > 0 {
		authHeader = j.jwtAuthHeader
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants