Skip to content

Commit

Permalink
Merge pull request #3784 from nats-io/flip-aud-sub
Browse files Browse the repository at this point in the history
[CHANGE] [AC] flip aud and sub for consistency
  • Loading branch information
derekcollison committed Jan 17, 2023
2 parents 4d52135 + 2f080ac commit 4e4a2d7
Showing 1 changed file with 7 additions and 7 deletions.
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
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

0 comments on commit 4e4a2d7

Please sign in to comment.