Skip to content

Commit

Permalink
fix(oidc): return correct extra claims (#7071)
Browse files Browse the repository at this point in the history
The GetExtraClaims function is called during introspection which doesn't need the extra claims from the ID Token Session.

Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
  • Loading branch information
james-d-elliott committed Apr 3, 2024
1 parent 11328cd commit a9021aa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions internal/oidc/session.go
Expand Up @@ -167,10 +167,6 @@ func (s *Session) GetIDTokenClaims() *jwt.IDTokenClaims {

// GetExtraClaims returns the Extra/Unregistered claims for this session.
func (s *Session) GetExtraClaims() map[string]any {
if s.DefaultSession != nil && s.DefaultSession.Claims != nil {
return s.DefaultSession.Claims.Extra
}

return s.Extra
}

Expand Down
4 changes: 2 additions & 2 deletions internal/oidc/session_test.go
Expand Up @@ -48,7 +48,7 @@ func TestOpenIDSession_GetExtraClaims(t *testing.T) {
},
},
{
"ShouldReturnIDTokenClaimsExtra",
"ShouldNotReturnIDTokenClaimsExtra",
&oidc.Session{
DefaultSession: &openid.DefaultSession{
Claims: &jwt.IDTokenClaims{
Expand All @@ -62,7 +62,7 @@ func TestOpenIDSession_GetExtraClaims(t *testing.T) {
},
},
map[string]any{
"b": 2,
"a": 1,
},
},
}
Expand Down

0 comments on commit a9021aa

Please sign in to comment.