-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
authorities in the User between Spring Security Core version 6.1.0 and 6.1.2 #13734
Comments
@CyrilStar, just have a look to answer from this question and i think it is the reason. |
It appears they first added a Then the implementation was changed from clear + addAll to new ArrayList as a "polish" in commit: Now the initial change of adding clear was done so calling authorities twice would result in replacing the authorities inside the builder instead of adding. Bottom line: it seems impossible to use both roles() and authorities() as they both replace all authorities. Just another nice Spring Security breaking change in a patch release. |
Apologies for the confusion everyone. Please see release notes for release 6.1.1 which includes gh-13290. Here's the timeline, hopefully it clears everything up:
In conclusion, the Having said that, the behavior outlined in the OP of this issue is not intended, and since we can't have it act both ways, we will keep it the way it was prior to 6.1. I'm going to go ahead and close this issue based on that explanation. |
my code
i defined an in-memory User object.
see the breakpoint result
source code differ
Spring Security Core version 6.1.0 used "addAll();" but Spring Security Core version 6.1.2 is "new ArrayList<>(authorities);"
I want to know what the official team's intention was in making these modifications.
The text was updated successfully, but these errors were encountered: