Skip to content

fix: update session grants in the auth code token endpoint handler #848

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions handler/oauth2/flow_authorize_code_token.go
Original file line number Diff line number Diff line change
@@ -64,9 +64,15 @@ func (c *AuthorizeExplicitGrantHandler) HandleTokenEndpointRequest(ctx context.C

// Override scopes
request.SetRequestedScopes(authorizeRequest.GetRequestedScopes())
for _, scope := range authorizeRequest.GetGrantedScopes() {
request.GrantScope(scope)
}

// Override audiences
request.SetRequestedAudience(authorizeRequest.GetRequestedAudience())
for _, audience := range authorizeRequest.GetGrantedAudience() {
request.GrantAudience(audience)
}

// The authorization server MUST ensure that the authorization code was issued to the authenticated
// confidential client, or if the client is public, ensure that the
@@ -131,14 +137,6 @@ func (c *AuthorizeExplicitGrantHandler) PopulateTokenEndpointResponse(ctx contex
return errorsx.WithStack(fosite.ErrInvalidRequest.WithWrap(err).WithDebug(err.Error()))
}

for _, scope := range authorizeRequest.GetGrantedScopes() {
requester.GrantScope(scope)
}

for _, audience := range authorizeRequest.GetGrantedAudience() {
requester.GrantAudience(audience)
}

access, accessSignature, err := c.AccessTokenStrategy.GenerateAccessToken(ctx, requester)
if err != nil {
return errorsx.WithStack(fosite.ErrServerError.WithWrap(err).WithDebug(err.Error()))
Loading
Oops, something went wrong.