1
0
mirror of synced 2026-08-03 08:51:58 +00:00

SEC-1459: Generifying AuthenticationUserDetailsService. Now parameterized with <? extends Authentication>.

This commit is contained in:
Luke Taylor
2010-04-15 01:47:29 +01:00
parent a45d2a4fb2
commit 74896f217b
10 changed files with 38 additions and 35 deletions
@@ -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;
}
@@ -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());
}
@@ -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() {