Skip to content

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

Open
wants to merge 3 commits into
base: latest
Choose a base branch
from

Conversation

mcollovati
Copy link
Contributor

Refactors impersonation example to get the correct security context holder as a parameter, to avoid wiring the dependency by name.

Refactors impersonation example to get the correct security context holder as a parameter, to avoid wiring the dependency by name.
@mcollovati mcollovati requested review from heruan and mshabarov May 8, 2025 06:22
Copy link

github-actions bot commented May 8, 2025

AI Language Review

  • In the section titled "Spring Impersonation with Vaadin," the use of the class VaadinAwareSecurityContextHolderStrategy and the annotation @Import(VaadinAwareSecurityContextHolderStrategyConfiguration.class) needs clarification. Ensure that these elements are consistently referenced and correctly explained.

  • There is a minor typo in the explanation under the note section for the "Spring Impersonation with Vaadin" where "If your are not using..." should be corrected to "If you are not using...".

  • Review the placement of punctuation marks and ensure alignment with the standard American English conventions.

@@ -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.
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@mcollovati mcollovati added the flow label May 8, 2025
@mcollovati mcollovati requested a review from mshabarov May 8, 2025 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants