Skip to content

Commit

Permalink
fix: set iss from userinfo claims if missing (ory#3744)
Browse files Browse the repository at this point in the history
  • Loading branch information
hperl authored Feb 7, 2024
1 parent 34751a1 commit 241a911
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions selfservice/strategy/oidc/provider_generic_oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,17 @@ func (g *ProviderGenericOIDC) claimsFromUserInfo(ctx context.Context, exchange *
return nil, errors.WithStack(herodot.ErrBadRequest.WithReason("sub (Subject) claim mismatch between ID token and UserInfo endpoint"))
}

// If signed, the UserInfo Response MUST contain the Claims iss (issuer) and aud
// (audience) as members. The iss value MUST be the OP's Issuer Identifier URL.
// The aud value MUST be or include the RP's Client ID value.
// See https://openid.net/specs/openid-connect-core-1_0.html#UserInfoResponse
//
// Consequently, the issuer might not be present in the UserInfo response and we
// need to set it here.
if claims.Issuer == "" {
claims.Issuer = idToken.Issuer
}

return &claims, nil
}

Expand Down

0 comments on commit 241a911

Please sign in to comment.