Class UserDetailsByNameServiceWrapper<T extends Authentication>
java.lang.Object
org.springframework.security.core.userdetails.UserDetailsByNameServiceWrapper<T>
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean,AuthenticationUserDetailsService<T>
public class UserDetailsByNameServiceWrapper<T extends Authentication>
extends Object
implements AuthenticationUserDetailsService<T>, org.springframework.beans.factory.InitializingBean
This implementation for AuthenticationUserDetailsService wraps a regular Spring
Security UserDetailsService implementation, to retrieve a UserDetails object based on
the user name contained in an Authentication object.
- Since:
- 2.0
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty wrapper for compatibility with Spring Security 2.0.x's method of using a setter.UserDetailsByNameServiceWrapper(UserDetailsService userDetailsService) Constructs a new wrapper using the suppliedUserDetailsServiceas the service to delegate to. -
Method Summary
Modifier and TypeMethodDescriptionvoidCheck whether all required properties have been set.loadUserDetails(T authentication) Get the UserDetails object from the wrapped UserDetailsService implementationvoidsetUserDetailsService(UserDetailsService aUserDetailsService) Set the wrapped UserDetailsService implementation
-
Constructor Details
-
UserDetailsByNameServiceWrapper
public UserDetailsByNameServiceWrapper()Constructs an empty wrapper for compatibility with Spring Security 2.0.x's method of using a setter. -
UserDetailsByNameServiceWrapper
Constructs a new wrapper using the suppliedUserDetailsServiceas the service to delegate to.- Parameters:
userDetailsService- the UserDetailsService to delegate to.
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()Check whether all required properties have been set.- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- See Also:
-
InitializingBean.afterPropertiesSet()
-
loadUserDetails
Get the UserDetails object from the wrapped UserDetailsService implementation- Specified by:
loadUserDetailsin interfaceAuthenticationUserDetailsService<T extends Authentication>- Parameters:
authentication- The pre-authenticated authentication token- Returns:
- UserDetails for the given authentication token, never null.
- Throws:
UsernameNotFoundException- if no user details can be found for the given authentication token
-
setUserDetailsService
Set the wrapped UserDetailsService implementation- Parameters:
aUserDetailsService- The wrapped UserDetailsService to set
-