Skip to content

Add setter for authorities claim name in JwtGrantedAuthoritiesConverter - #7271

Merged
jzheaux merged 2 commits into
spring-projects:masterfrom
andifalk:gh-7100
Aug 20, 2019
Merged

jzheaux merged 2 commits into
spring-projects:masterfrom
andifalk:gh-7100

Conversation

@andifalk

Copy link
Copy Markdown

Fixes gh-7100

Prior to this change authorities are always mapped using well known
claim names ('scp' or 'scope'). To change this default behaviour the
converter had to be replaced completely with a custom one.
This commit adds an additional setter to configure a custom
claim name like for example 'roles' to map authorities.
Without specifying a custom claim name
the default claims to be used still remains to
the well known ones ('scp' and 'scope').

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 16, 2019

@jzheaux jzheaux left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @andifalk! I've left some feedback inline.

Andreas Falk added 2 commits August 18, 2019 16:49
Prior to this change authorities are always mapped using well known
claim names ('scope' or 'scp'). To change this default behaviour the
converter had to be replaced completely with a custom one.
This commit adds an additional setter to configure a custom
claim name like e.g. 'roles'. Without specifying a custom claim name
the default claims to be used still remains to the well known ones.
This way the authorities can be mapped according to customized
token claims.

Fixes spring-projectsgh-7100
Some negative test cases were missing. Added these to have
full test coverage for JwtGrantedAuthoritiesConverter.
@jzheaux jzheaux self-assigned this Aug 20, 2019
@jzheaux jzheaux added in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: duplicate A duplicate of another issue type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 20, 2019
@jzheaux jzheaux added this to the 5.2.0.RC1 milestone Aug 20, 2019
@jzheaux
jzheaux merged commit 766c443 into spring-projects:master Aug 20, 2019
@jzheaux

jzheaux commented Aug 20, 2019

Copy link
Copy Markdown
Collaborator

Thanks for another PR, @andifalk! This is now merged into master.

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) status: duplicate A duplicate of another issue type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JwtGrantedAuthoritiesConverter should allow configuring the authorities claim name

3 participants