-
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
AnonymousConfigurer not work using Custom DSL #14941
Comments
I think to modify the added
|
Thank you for your suggestion @kse-music , but this is not what I am looking for. The document mentions that it is possible to add other configurers to a custom DSL: Therefore, I'm planning to design some custom DSLs targeted at our common scenarios, providing a quick configuration to configure HttpSecurity for developers. |
If the init method of the custom
When the I think there are still some @jzheaux I don’t know what I understand, right? |
I'm using
Describe the bug
While playing around with Custom DSL, I noticed adding an anonymous configurer does not work
To Reproduce
Expected behavior
I expected the anonymous principal to be
myAnonymousUser
, but the actual result wasanonymousUser
, which is the default name set by AnonymousConfigurer.Sample
https://github.com/shihyuho/anonymous-configurer-issue
Additional Notes
Upon tracing the code, the reason appears to be:
In HttpSecurityConfiguration,
.anonymous(withDefaults())
is already set once when creatingHttpSecurity
instance, and in theinit
method of AnonymousConfigurer, theauthenticationFilter
is initialized.As a result, although the
principal
can still be changed later with custom DSL, the filter is not recreated, which prevents the changes from taking effect.The text was updated successfully, but these errors were encountered: