-
Notifications
You must be signed in to change notification settings - Fork 209
docs: refactor impersonation example #4294
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
base: latest
Are you sure you want to change the base?
Conversation
Refactors impersonation example to get the correct security context holder as a parameter, to avoid wiring the dependency by name.
AI Language Review
|
@@ -587,7 +587,7 @@ To add impersonation for a Vaadin application, create the [classname]`SwitchUser | |||
---- | |||
|
|||
[NOTE] | |||
The bean should depend on `VaadinSecurityContextHolderStrategy` bean. If the [classname]`SwitchUserFilter` is initialized first, the wrong security holder is used and the feature won't work. | |||
The bean should use `VaadinSecurityContextHolderStrategy` bean to work properly. If the [classname]`SwitchUserFilter` is initialized differently, the wrong security holder is used and the feature won't work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to inject the strategy as the interface SecurityContextHolderStrategy
, in case the user provides their own strategy bean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filter needs VaadinSecurityContextHolderStrategy
to work properly with Vaadin. A different strategy (e.g. ThreadLocal
) will potentially fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a note suggesting to add @Import(VaadinAwareSecurityContextHolderStrategyConfiguration.class)
if application is not using VaadinWebSecurity
as a base configuration class.
Refactors impersonation example to get the correct security context holder as a parameter, to avoid wiring the dependency by name.