SEC-1830: Use constructor injection in namespace parsing code for creation of ProviderManager
This commit is contained in:
parent
9d66e1fac3
commit
ac6ed671a1
|
@ -83,7 +83,7 @@ public class AuthenticationManagerBeanDefinitionParser implements BeanDefinition
|
||||||
providers.add(new RootBeanDefinition(NullAuthenticationProvider.class));
|
providers.add(new RootBeanDefinition(NullAuthenticationProvider.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
providerManagerBldr.addPropertyValue("providers", providers);
|
providerManagerBldr.addConstructorArgValue(providers);
|
||||||
|
|
||||||
if ("false".equals(element.getAttribute(ATT_ERASE_CREDENTIALS))) {
|
if ("false".equals(element.getAttribute(ATT_ERASE_CREDENTIALS))) {
|
||||||
providerManagerBldr.addPropertyValue("eraseCredentialsAfterAuthentication", false);
|
providerManagerBldr.addPropertyValue("eraseCredentialsAfterAuthentication", false);
|
||||||
|
|
|
@ -471,7 +471,7 @@ class HttpConfigurationBuilder {
|
||||||
voters.add(new RootBeanDefinition(AuthenticatedVoter.class));
|
voters.add(new RootBeanDefinition(AuthenticatedVoter.class));
|
||||||
}
|
}
|
||||||
accessDecisionMgr = new RootBeanDefinition(AffirmativeBased.class);
|
accessDecisionMgr = new RootBeanDefinition(AffirmativeBased.class);
|
||||||
accessDecisionMgr.getPropertyValues().addPropertyValue("decisionVoters", voters);
|
accessDecisionMgr.getConstructorArgumentValues().addGenericArgumentValue(voters);
|
||||||
accessDecisionMgr.setSource(pc.extractSource(httpElt));
|
accessDecisionMgr.setSource(pc.extractSource(httpElt));
|
||||||
|
|
||||||
// Set up the access manager reference for http
|
// Set up the access manager reference for http
|
||||||
|
|
|
@ -187,8 +187,9 @@ public class HttpSecurityBeanDefinitionParser implements BeanDefinitionParser {
|
||||||
private BeanReference createAuthenticationManager(Element element, ParserContext pc,
|
private BeanReference createAuthenticationManager(Element element, ParserContext pc,
|
||||||
ManagedList<BeanReference> authenticationProviders) {
|
ManagedList<BeanReference> authenticationProviders) {
|
||||||
BeanDefinitionBuilder authManager = BeanDefinitionBuilder.rootBeanDefinition(ProviderManager.class);
|
BeanDefinitionBuilder authManager = BeanDefinitionBuilder.rootBeanDefinition(ProviderManager.class);
|
||||||
authManager.addPropertyValue("parent", new RootBeanDefinition(AuthenticationManagerFactoryBean.class));
|
authManager.addConstructorArgValue(authenticationProviders);
|
||||||
authManager.addPropertyValue("providers", authenticationProviders);
|
authManager.addConstructorArgValue(new RootBeanDefinition(AuthenticationManagerFactoryBean.class));
|
||||||
|
|
||||||
RootBeanDefinition clearCredentials = new RootBeanDefinition(MethodInvokingFactoryBean.class);
|
RootBeanDefinition clearCredentials = new RootBeanDefinition(MethodInvokingFactoryBean.class);
|
||||||
clearCredentials.getPropertyValues().addPropertyValue("targetObject", new RootBeanDefinition(AuthenticationManagerFactoryBean.class));
|
clearCredentials.getPropertyValues().addPropertyValue("targetObject", new RootBeanDefinition(AuthenticationManagerFactoryBean.class));
|
||||||
clearCredentials.getPropertyValues().addPropertyValue("targetMethod", "isEraseCredentialsAfterAuthentication");
|
clearCredentials.getPropertyValues().addPropertyValue("targetMethod", "isEraseCredentialsAfterAuthentication");
|
||||||
|
|
|
@ -247,7 +247,7 @@ public class GlobalMethodSecurityBeanDefinitionParser implements BeanDefinitionP
|
||||||
voters.add(new RootBeanDefinition(Jsr250Voter.class));
|
voters.add(new RootBeanDefinition(Jsr250Voter.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
accessMgrBuilder.addPropertyValue("decisionVoters", voters);
|
accessMgrBuilder.addConstructorArgValue(voters);
|
||||||
|
|
||||||
BeanDefinition accessManager = accessMgrBuilder.getBeanDefinition();
|
BeanDefinition accessManager = accessMgrBuilder.getBeanDefinition();
|
||||||
String id = pc.getReaderContext().generateBeanName(accessManager);
|
String id = pc.getReaderContext().generateBeanName(accessManager);
|
||||||
|
|
Loading…
Reference in New Issue