Polish SecurityContextHolderStrategy XML Configuration for Defaults
Issue gh-11061
This commit is contained in:
parent
4a2d77d3f2
commit
b3be35da31
|
@ -601,6 +601,7 @@ class HttpConfigurationBuilder {
|
||||||
this.servApiFilter = GrantedAuthorityDefaultsParserUtils.registerWithDefaultRolePrefix(this.pc,
|
this.servApiFilter = GrantedAuthorityDefaultsParserUtils.registerWithDefaultRolePrefix(this.pc,
|
||||||
SecurityContextHolderAwareRequestFilterBeanFactory.class);
|
SecurityContextHolderAwareRequestFilterBeanFactory.class);
|
||||||
this.servApiFilter.getPropertyValues().add("authenticationManager", authenticationManager);
|
this.servApiFilter.getPropertyValues().add("authenticationManager", authenticationManager);
|
||||||
|
this.servApiFilter.getPropertyValues().add("securityContextHolderStrategy", this.holderStrategyRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,12 +904,20 @@ class HttpConfigurationBuilder {
|
||||||
|
|
||||||
private SecurityContextHolderAwareRequestFilter filter = new SecurityContextHolderAwareRequestFilter();
|
private SecurityContextHolderAwareRequestFilter filter = new SecurityContextHolderAwareRequestFilter();
|
||||||
|
|
||||||
|
private SecurityContextHolderStrategy securityContextHolderStrategy = SecurityContextHolder
|
||||||
|
.getContextHolderStrategy();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SecurityContextHolderAwareRequestFilter getBean() {
|
public SecurityContextHolderAwareRequestFilter getBean() {
|
||||||
|
this.filter.setSecurityContextHolderStrategy(this.securityContextHolderStrategy);
|
||||||
this.filter.setRolePrefix(this.rolePrefix);
|
this.filter.setRolePrefix(this.rolePrefix);
|
||||||
return this.filter;
|
return this.filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy) {
|
||||||
|
this.securityContextHolderStrategy = securityContextHolderStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class SecurityContextHolderStrategyFactory implements FactoryBean<SecurityContextHolderStrategy> {
|
static class SecurityContextHolderStrategyFactory implements FactoryBean<SecurityContextHolderStrategy> {
|
||||||
|
|
Loading…
Reference in New Issue