-
Notifications
You must be signed in to change notification settings - Fork 187
refactor: Obtain SecurityContext from the SecurityContextHolderStrategy bean #21665
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: main
Are you sure you want to change the base?
Conversation
95f2ac4
to
06f63c2
Compare
|
* @param evaluator | ||
* evaluator to check path permissions. | ||
* @deprecated Use | ||
* {@link #SpringAccessPathChecker(WebInvocationPrivilegeEvaluator, String)} |
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.
* {@link #SpringAccessPathChecker(WebInvocationPrivilegeEvaluator, String)} | |
* {@link #SpringAccessPathChecker(SecurityContextHolderStrategy, WebInvocationPrivilegeEvaluator)} |
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.
It would be good to add a note mentioning usage of SecurityContextHolder#getContextHolderStrategy()
in the deprecated constructors to explain the deprecation (similar to AuthenticationContext
)
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 wonder if we should just remove the @Configuration
annotation and deprecate the class for 24.8
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.
Yes, that would be better. I initially removed the class to see what failed without it, but we can keep it and deprecate before complete removal.
06f63c2
to
5eb99f8
Compare
9d38154
to
4d566a5
Compare
|
One missing part: restore and deprecate |
This fixes #21401 by providing a
SecurityContextHolderStrategy
bean as part of Spring Security auto-configuration and replaces static invocations ofSecurityContextHolder.getContext()
by using the strategy bean instead.SecurityContextHolderStrategy
inSpringSecurityAutoConfiguration
VaadinAwareSecurityContextHolderStrategyConfiguration
VaadinSecurityConfigurer
build lifecycleVaadinWebSecurity
for backwards compatibilityAuthenticationContext
andSpringAccessPathChecker
AuthenticationUtil
methodsBreaking changes
VaadinAwareSecurityContextHolderStrategyConfiguration
has been removed — mild since it was purely for internal useSpringSecurityAutoConfiguration::accessPatchChecker
signature has changed to include the strategy parameter — mild since this class shouldn't be extended (better have package-private bean methods)VaadinAwareSecurityContextHolderStrategyConfiguration
might expect that custom strategy to be used by Flow, instead of the bean — those apps should now provide the custom strategy as a bean (if they expect Flow to use it)DRAFT Tests setting the strategy statically must be updated (some already are)