SEC-330: Make UserMap work with UserDetails, not User concrete class.

This commit is contained in:
Ben Alex 2006-09-15 03:47:17 +00:00
parent f0b259a32e
commit 9e3ce85dd5
1 changed files with 8 additions and 11 deletions

View File

@ -15,18 +15,15 @@
package org.acegisecurity.userdetails.memory; package org.acegisecurity.userdetails.memory;
import org.acegisecurity.userdetails.User;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.Assert;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.Assert;
/** /**
* Used by {@link InMemoryDaoImpl} to store a list of users and their corresponding granted authorities. * Used by {@link InMemoryDaoImpl} to store a list of users and their corresponding granted authorities.
@ -68,8 +65,8 @@ public class UserMap {
* *
* @throws UsernameNotFoundException if the user could not be found * @throws UsernameNotFoundException if the user could not be found
*/ */
public User getUser(String username) throws UsernameNotFoundException { public UserDetails getUser(String username) throws UsernameNotFoundException {
User result = (User) this.userMap.get(username.toLowerCase()); UserDetails result = (UserDetails) this.userMap.get(username.toLowerCase());
if (result == null) { if (result == null) {
throw new UsernameNotFoundException("Could not find user: " + username); throw new UsernameNotFoundException("Could not find user: " + username);