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

[CHANGE] [AC] flip aud and sub for consistency #3784

Merged
merged 1 commit into from Jan 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions server/auth_callout.go
Expand Up @@ -204,8 +204,13 @@ func (s *Server) processClientOrLeafCallout(c *client, opts *Options) (authorize
}
defer acc.unsubscribeInternal(sub)

// Build our request claims.
claim := jwt.NewAuthorizationRequestClaims(AuthRequestSubject)
// Build our request claims - jwt subject should be nkey
jwtSub := acc.Name
Copy link
Member Author

Choose a reason for hiding this comment

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

Also wondering if this really should acc.NKey and name is a last resort.

if opts.AuthCallout != nil {
jwtSub = opts.AuthCallout.Issuer
}
claim := jwt.NewAuthorizationRequestClaims(jwtSub)
claim.Audience = AuthRequestSubject
// Set expected public user nkey.
claim.UserNkey = pub

Expand All @@ -229,11 +234,6 @@ func (s *Server) processClientOrLeafCallout(c *client, opts *Options) (authorize

authTimeout := secondsToDuration(s.getOpts().AuthTimeout)
claim.Expires = time.Now().Add(time.Duration(authTimeout)).UTC().Unix()
if opts.AuthCallout != nil {
claim.Audience = opts.AuthCallout.Issuer
} else {
claim.Audience = acc.Name
}

// Grab client info for the request.
c.mu.Lock()
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.