Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ClaimAccessor and externalize coercion #6245

Closed
jgrandja opened this issue Dec 6, 2018 · 1 comment
Closed

Improve ClaimAccessor and externalize coercion #6245

jgrandja opened this issue Dec 6, 2018 · 1 comment
Assignees
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: enhancement A general enhancement
Milestone

Comments

@jgrandja
Copy link
Contributor

jgrandja commented Dec 6, 2018

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.

@jgrandja jgrandja added type: enhancement A general enhancement in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) OIDC labels Dec 6, 2018
@jgrandja jgrandja added this to the 5.2.0.M2 milestone Dec 6, 2018
@jgrandja
Copy link
Contributor Author

jgrandja commented Dec 6, 2018

Related #6187 #5250

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants