SEC-1459: Generifying AuthenticationUserDetailsService. Now parameterized with <? extends Authentication>.
This commit is contained in:
+2
-2
@@ -9,7 +9,7 @@ import org.springframework.security.core.Authentication;
|
||||
* @author Ruud Senden
|
||||
* @since 2.0
|
||||
*/
|
||||
public interface AuthenticationUserDetailsService {
|
||||
public interface AuthenticationUserDetailsService<T extends Authentication> {
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -19,5 +19,5 @@ public interface AuthenticationUserDetailsService {
|
||||
* if no user details can be found for the given authentication
|
||||
* token
|
||||
*/
|
||||
UserDetails loadUserDetails(Authentication token) throws UsernameNotFoundException;
|
||||
UserDetails loadUserDetails(T token) throws UsernameNotFoundException;
|
||||
}
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ import org.springframework.util.Assert;
|
||||
* @author Scott Battaglia
|
||||
* @since 2.0
|
||||
*/
|
||||
public class UserDetailsByNameServiceWrapper implements AuthenticationUserDetailsService, InitializingBean {
|
||||
public class UserDetailsByNameServiceWrapper<T extends Authentication> implements AuthenticationUserDetailsService<T>, InitializingBean {
|
||||
private UserDetailsService userDetailsService = null;
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ public class UserDetailsByNameServiceWrapper implements AuthenticationUserDetail
|
||||
* Get the UserDetails object from the wrapped UserDetailsService
|
||||
* implementation
|
||||
*/
|
||||
public UserDetails loadUserDetails(Authentication authentication) throws UsernameNotFoundException {
|
||||
public UserDetails loadUserDetails(T authentication) throws UsernameNotFoundException {
|
||||
return this.userDetailsService.loadUserByUsername(authentication.getName());
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -10,6 +10,7 @@ import org.springframework.security.core.authority.AuthorityUtils;
|
||||
* @author TSARDD
|
||||
* @since 18-okt-2007
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class UserDetailsByNameServiceWrapperTests extends TestCase {
|
||||
|
||||
public final void testAfterPropertiesSet() {
|
||||
|
||||
Reference in New Issue
Block a user