Skip to content

Generating ID token when sid null during refresh_token grant throws IllegalArgumentException #1283

Closed
@cbilodeauupgrade

Description

@cbilodeauupgrade

Describe the bug
Generating a refresh_token with null sid from the OidcIdToken claims throw IllegalArgumentException

To Reproduce
Don't set the SessionRegistry on the OAuth2AuthorizationCodeAuthenticationProvider or use a SessionRegistry that don't return SessionInformation

Expected behavior
Generating a refresh_token with null sid from the OidcIdToken claims should not throw an exception.

Context
According to the specification (https://openid.net/specs/openid-connect-backchannel-1_0.html#LogoutToken):

sid
OPTIONAL. Session ID - String identifier for a Session. This represents a Session of a User Agent or device for a logged-in End-User at an RP. Different sid values are used to identify distinct sessions at an OP. The sid value need only be unique in the context of a particular issuer. Its contents are opaque to the RP. Its syntax is the same as an OAuth 2.0 Client Identifier.

At the moment, the sid can be null in the OidcIdToken if the SessionInformation was not found but it's throw a IllegalArgumentException when generating a refresh_token.


should be

if (currentIdToken.getClaim("sid") != null) {
  claimsBuilder.claim("sid", currentIdToken.getClaim("sid"));
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions