Skip to content

Change AbstractAuthenticationToken.getAuthorities to be mutable #7242

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
sincang opened this issue Aug 9, 2019 · 1 comment
Closed

Change AbstractAuthenticationToken.getAuthorities to be mutable #7242

sincang opened this issue Aug 9, 2019 · 1 comment
Assignees
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@sincang
Copy link

sincang commented Aug 9, 2019

In the class AbstractAuthenticationToken, Array of GrantedAuthority is aways wrapped with Collections.unmofiableList. Will it be possible to make this list just modifiable? The reason is this stops OauthTokenEnhancer to modify the authorities. The use case is based on the Client scope, token enhancer should be able to remove unrelevant roles or authorities.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 9, 2019
@rwinch rwinch changed the title AbstractAuthenticationToken Change AbstractAuthenticationToken.getAuthorities to be mutable Aug 12, 2019
@rwinch rwinch self-assigned this Aug 12, 2019
@rwinch rwinch added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 12, 2019
@rwinch
Copy link
Member

rwinch commented Aug 12, 2019

We cannot make it mutable as this causes concurrency problems. The approach you need to take is to create a new instance of the Authentication with updated authorities

@rwinch rwinch closed this as completed Aug 12, 2019
jzheaux added a commit that referenced this issue Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

3 participants