Skip to content

Improve ClaimAccessor and externalize coercion #6245

Closed
@jgrandja

Description

@jgrandja

The methods in ClaimAccessor attempt to coerce a mapped value of Object to a specific type, for example:

  • getClaimAsBoolean
  • getClaimAsInstant
  • getClaimAsURL

The coercion happens on each get which is not ideal. It would be more efficient if the coercion happened once and before the Map<String, Object> of claims is associated to the specific type of ClaimAccessor implementation at construction time. This change would apply to OidcIdToken, OidcUserInfo, and Jwt.

This capability is already implemented by MappedJwtClaimSetConverter, which is used by NimbusJwtDecoder to normalize the claims before it's associated to the Jwt.

We should reuse/share the logic in MappedJwtClaimSetConverter as part of this task. For example, the Converter implementations in MappedJwtClaimSetConverter should be reused.

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions