Skip to content

Add generic getClaim() method in ClaimAccessor #6947

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

Closed
jgrandja opened this issue Jun 3, 2019 · 5 comments
Closed

Add generic getClaim() method in ClaimAccessor #6947

jgrandja opened this issue Jun 3, 2019 · 5 comments
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 Jun 3, 2019

We should add a convenience (default) method in ClaimAccessor, as follows:

default <T> T getClaim(String claim) {
    return (T) this.getClaims().get(claim);
}

Related to comment

@jgrandja jgrandja self-assigned this Jun 3, 2019
@jgrandja jgrandja added in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: enhancement A general enhancement labels Jun 3, 2019
@jgrandja jgrandja added this to the 5.2.x milestone Jun 3, 2019
@jgrandja jgrandja removed their assignment Jun 4, 2019
@ThomasVitale
Copy link
Contributor

Hi @jgrandja, if needed I would be available to work on this issue

@jgrandja
Copy link
Contributor Author

@ThomasVitale That would be great! It should be pretty straight forward - similar to what we already have in OAuth2AuthorizationRequest.getAttribute() (in master). Let me know if you have any questions. Thanks.

@ThomasVitale
Copy link
Contributor

Hi @jgrandja, I created a PR for the issue, what do you think?

@jgrandja jgrandja self-assigned this Jun 17, 2019
@jgrandja jgrandja modified the milestones: 5.2.x, 5.2.0.RC1 Jun 17, 2019
kostya05983 pushed a commit to kostya05983/spring-security that referenced this issue Aug 26, 2019
@codemasterover9000
Copy link

Hi, we just upgraded to Spring Boot from 2.1.1 to 2.2.0. Now we have a failing test for our custom jwtAuthenticationConverter. It seems the implementation of method Jwt.getClaimAsStringList() has changed.

We had a case test where the authorization server sends a space separated list of authorities. In that case getClaimAsStringList() returned null and we did the parsing ourselves. Now it returns a list with the string value of the claim as its only entry.

This makes it harder to distinguish between an actual list and a space separated string value. Was this intentional?

@jgrandja
Copy link
Contributor Author

jgrandja commented Nov 6, 2019

@codemasterover9000 It's best to log a new issue instead of commenting on a closed issue. If you're still having problems, please log a new issue with as much detail as possible.

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.

3 participants