mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-28 23:02:15 +00:00
Switch to non-deprecated methods.
This commit is contained in:
parent
3e2930d785
commit
8587d4c635
@ -61,32 +61,32 @@ class AuthenticationProviderBeanDefinitionParser implements BeanDefinitionParser
|
||||
Elements.LDAP_USER_SERVICE + "'", element);
|
||||
}
|
||||
} else {
|
||||
// Use the child elements to create the UserDetailsService
|
||||
AbstractUserDetailsServiceBeanDefinitionParser parser = null;
|
||||
Element elt = null;
|
||||
// Use the child elements to create the UserDetailsService
|
||||
AbstractUserDetailsServiceBeanDefinitionParser parser = null;
|
||||
Element elt = null;
|
||||
|
||||
if (userServiceElt != null) {
|
||||
elt = userServiceElt;
|
||||
parser = new UserServiceBeanDefinitionParser();
|
||||
} else if (jdbcUserServiceElt != null) {
|
||||
elt = jdbcUserServiceElt;
|
||||
parser = new JdbcUserServiceBeanDefinitionParser();
|
||||
} else if (ldapUserServiceElt != null) {
|
||||
elt = ldapUserServiceElt;
|
||||
parser = new LdapUserServiceBeanDefinitionParser();
|
||||
} else {
|
||||
parserContext.getReaderContext().error("A user-service is required", element);
|
||||
}
|
||||
if (userServiceElt != null) {
|
||||
elt = userServiceElt;
|
||||
parser = new UserServiceBeanDefinitionParser();
|
||||
} else if (jdbcUserServiceElt != null) {
|
||||
elt = jdbcUserServiceElt;
|
||||
parser = new JdbcUserServiceBeanDefinitionParser();
|
||||
} else if (ldapUserServiceElt != null) {
|
||||
elt = ldapUserServiceElt;
|
||||
parser = new LdapUserServiceBeanDefinitionParser();
|
||||
} else {
|
||||
parserContext.getReaderContext().error("A user-service is required", element);
|
||||
}
|
||||
|
||||
parser.parse(elt, parserContext);
|
||||
ref = parser.getId();
|
||||
parser.parse(elt, parserContext);
|
||||
ref = parser.getId();
|
||||
}
|
||||
|
||||
authProvider.getPropertyValues().addPropertyValue("userDetailsService", new RuntimeBeanReference(ref));
|
||||
|
||||
BeanDefinitionBuilder cacheResolverBldr = BeanDefinitionBuilder.rootBeanDefinition(AuthenticationProviderCacheResolver.class);
|
||||
cacheResolverBldr.addConstructorArg(id);
|
||||
cacheResolverBldr.addConstructorArg(ref);
|
||||
cacheResolverBldr.addConstructorArgValue(id);
|
||||
cacheResolverBldr.addConstructorArgValue(ref);
|
||||
cacheResolverBldr.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
BeanDefinition cacheResolver = cacheResolverBldr.getBeanDefinition();
|
||||
|
||||
@ -104,30 +104,30 @@ class AuthenticationProviderBeanDefinitionParser implements BeanDefinitionParser
|
||||
* authentication provider.
|
||||
*/
|
||||
static class AuthenticationProviderCacheResolver implements BeanFactoryPostProcessor, Ordered {
|
||||
private String providerId;
|
||||
private String userServiceId;
|
||||
private String providerId;
|
||||
private String userServiceId;
|
||||
|
||||
public AuthenticationProviderCacheResolver(String providerId, String userServiceId) {
|
||||
this.providerId = providerId;
|
||||
this.userServiceId = userServiceId;
|
||||
}
|
||||
public AuthenticationProviderCacheResolver(String providerId, String userServiceId) {
|
||||
this.providerId = providerId;
|
||||
this.userServiceId = userServiceId;
|
||||
}
|
||||
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
RootBeanDefinition provider = (RootBeanDefinition) beanFactory.getBeanDefinition(providerId);
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
RootBeanDefinition provider = (RootBeanDefinition) beanFactory.getBeanDefinition(providerId);
|
||||
|
||||
String cachingId = userServiceId + AbstractUserDetailsServiceBeanDefinitionParser.CACHING_SUFFIX;
|
||||
String cachingId = userServiceId + AbstractUserDetailsServiceBeanDefinitionParser.CACHING_SUFFIX;
|
||||
|
||||
if (beanFactory.containsBeanDefinition(cachingId)) {
|
||||
RootBeanDefinition cachingUserService = (RootBeanDefinition) beanFactory.getBeanDefinition(cachingId);
|
||||
if (beanFactory.containsBeanDefinition(cachingId)) {
|
||||
RootBeanDefinition cachingUserService = (RootBeanDefinition) beanFactory.getBeanDefinition(cachingId);
|
||||
|
||||
PropertyValue userCacheProperty = cachingUserService.getPropertyValues().getPropertyValue("userCache");
|
||||
PropertyValue userCacheProperty = cachingUserService.getPropertyValues().getPropertyValue("userCache");
|
||||
|
||||
provider.getPropertyValues().addPropertyValue(userCacheProperty);
|
||||
}
|
||||
}
|
||||
provider.getPropertyValues().addPropertyValue(userCacheProperty);
|
||||
}
|
||||
}
|
||||
|
||||
public int getOrder() {
|
||||
return HIGHEST_PRECEDENCE;
|
||||
}
|
||||
public int getOrder() {
|
||||
return HIGHEST_PRECEDENCE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user