fix: add state in access token response (implicit flow)

This commit is contained in:
Livio Amstutz 2022-06-17 09:33:30 +02:00
parent bb4d854efe
commit f345ddd0c5
No known key found for this signature in database
GPG key ID: 26BB1C2FA5952CF0
2 changed files with 4 additions and 0 deletions

View file

@ -396,6 +396,7 @@ type AccessTokenResponse struct {
RefreshToken string `json:"refresh_token,omitempty" schema:"refresh_token,omitempty"`
ExpiresIn uint64 `json:"expires_in,omitempty" schema:"expires_in,omitempty"`
IDToken string `json:"id_token,omitempty" schema:"id_token,omitempty"`
State string `json:"state,omitempty" schema:"state,omitempty"`
}
type JWTProfileAssertionClaims interface {

View file

@ -35,11 +35,13 @@ func CreateTokenResponse(ctx context.Context, request IDTokenRequest, client Cli
return nil, err
}
var state string
if authRequest, ok := request.(AuthRequest); ok {
err = creator.Storage().DeleteAuthRequest(ctx, authRequest.GetID())
if err != nil {
return nil, err
}
state = authRequest.GetState()
}
exp := uint64(validity.Seconds())
@ -49,6 +51,7 @@ func CreateTokenResponse(ctx context.Context, request IDTokenRequest, client Cli
RefreshToken: newRefreshToken,
TokenType: oidc.BearerToken,
ExpiresIn: exp,
State: state,
}, nil
}