Skip to content

AbstractSecurityInterceptor has old strategy after change of strategyName #12561

@huehnerlady

Description

@huehnerlady

Describe the bug
After updating to the version 5.8.1, we have a problem with the AbstractSecurityInterceptor.
In our code we change the strategy name at runtime, which is possible through this method.
When changing the strategyName a new initialization of the SecurityContextStrategy is done.
This however is not known by the AbstractSecurityInterceptor, which is retrieving the strategy once when the object is initialized here.

So if the AbstractSecurityInterceptor is initialized AFTER the change of the SecurityContextStrategy, all is fine, but if it was initialized BEFORE the change the strategy is still the old one and not the current one which then later results in an exception when trying to receive the Authentication here.

To Reproduce
Use my sample project and run the test DemoApplicationTests
There I set the strategy, create an interceptor, set another strategy and create an interceptor again.
You can see the strategies are different and so here it will have different results.

Expected behavior
the strategies to be the same OR at the point the variable is used to use the strategy directly instead

Sample
demo-abstractInterceptor.zip

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions