SEC-107: Rename AuthenticationDao to UserDetailsService.

This commit is contained in:
Ben Alex 2005-11-29 13:10:15 +00:00
parent c021362ebb
commit a6e23d79ae
81 changed files with 464 additions and 422 deletions

View File

@ -17,8 +17,8 @@ package org.acegisecurity.acl.basic;
import org.acegisecurity.Authentication; import org.acegisecurity.Authentication;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.UserDetails;
import org.acegisecurity.acl.AclEntry; import org.acegisecurity.acl.AclEntry;
import org.acegisecurity.userdetails.UserDetails;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;

View File

@ -16,8 +16,8 @@
package org.acegisecurity.concurrent; package org.acegisecurity.concurrent;
import org.acegisecurity.Authentication; import org.acegisecurity.Authentication;
import org.acegisecurity.UserDetails;
import org.acegisecurity.ui.WebAuthenticationDetails; import org.acegisecurity.ui.WebAuthenticationDetails;
import org.acegisecurity.userdetails.UserDetails;
import org.springframework.util.Assert; import org.springframework.util.Assert;

View File

@ -16,7 +16,7 @@
package org.acegisecurity.event.authentication; package org.acegisecurity.event.authentication;
import org.acegisecurity.Authentication; import org.acegisecurity.Authentication;
import org.acegisecurity.UserDetails; import org.acegisecurity.userdetails.UserDetails;
/** /**

View File

@ -16,7 +16,7 @@
package org.acegisecurity.providers; package org.acegisecurity.providers;
import org.acegisecurity.Authentication; import org.acegisecurity.Authentication;
import org.acegisecurity.UserDetails; import org.acegisecurity.userdetails.UserDetails;
/** /**

View File

@ -42,7 +42,7 @@ import org.acegisecurity.event.authentication.AuthenticationFailureServiceExcept
import org.acegisecurity.event.authentication.AuthenticationSuccessEvent; import org.acegisecurity.event.authentication.AuthenticationSuccessEvent;
import org.acegisecurity.providers.cas.ProxyUntrustedException; import org.acegisecurity.providers.cas.ProxyUntrustedException;
import org.acegisecurity.providers.dao.UsernameNotFoundException; import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;

View File

@ -17,7 +17,7 @@ package org.acegisecurity.providers.anonymous;
import org.acegisecurity.Authentication; import org.acegisecurity.Authentication;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.providers.dao.memory.UserAttribute; import org.acegisecurity.userdetails.memory.UserAttribute;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;

View File

@ -18,12 +18,12 @@ package org.acegisecurity.providers.cas;
import org.acegisecurity.Authentication; import org.acegisecurity.Authentication;
import org.acegisecurity.AuthenticationException; import org.acegisecurity.AuthenticationException;
import org.acegisecurity.BadCredentialsException; import org.acegisecurity.BadCredentialsException;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.AuthenticationProvider; import org.acegisecurity.providers.AuthenticationProvider;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.ui.cas.CasProcessingFilter; import org.acegisecurity.ui.cas.CasProcessingFilter;
import org.acegisecurity.userdetails.UserDetails;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;

View File

@ -16,8 +16,8 @@
package org.acegisecurity.providers.cas; package org.acegisecurity.providers.cas;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.AbstractAuthenticationToken; import org.acegisecurity.providers.AbstractAuthenticationToken;
import org.acegisecurity.userdetails.UserDetails;
import org.springframework.util.Assert; import org.springframework.util.Assert;

View File

@ -16,7 +16,7 @@
package org.acegisecurity.providers.cas; package org.acegisecurity.providers.cas;
import org.acegisecurity.AuthenticationException; import org.acegisecurity.AuthenticationException;
import org.acegisecurity.UserDetails; import org.acegisecurity.userdetails.UserDetails;
/** /**

View File

@ -16,16 +16,16 @@
package org.acegisecurity.providers.cas.populator; package org.acegisecurity.providers.cas.populator;
import org.acegisecurity.AuthenticationException; import org.acegisecurity.AuthenticationException;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.cas.CasAuthoritiesPopulator; import org.acegisecurity.providers.cas.CasAuthoritiesPopulator;
import org.acegisecurity.providers.dao.AuthenticationDao; import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.userdetails.UserDetails;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
* Populates the CAS authorities via an {@link AuthenticationDao}. * Populates the CAS authorities via an {@link UserDetailsService}.
* *
* <P> * <P>
* The additional information (username, password, enabled status etc) an * The additional information (username, password, enabled status etc) an
@ -41,15 +41,15 @@ public class DaoCasAuthoritiesPopulator implements CasAuthoritiesPopulator,
InitializingBean { InitializingBean {
//~ Instance fields ======================================================== //~ Instance fields ========================================================
private AuthenticationDao authenticationDao; private UserDetailsService authenticationDao;
//~ Methods ================================================================ //~ Methods ================================================================
public void setAuthenticationDao(AuthenticationDao authenticationDao) { public void setAuthenticationDao(UserDetailsService authenticationDao) {
this.authenticationDao = authenticationDao; this.authenticationDao = authenticationDao;
} }
public AuthenticationDao getAuthenticationDao() { public UserDetailsService getAuthenticationDao() {
return authenticationDao; return authenticationDao;
} }

View File

@ -21,11 +21,12 @@ import org.acegisecurity.AuthenticationException;
import org.acegisecurity.CredentialsExpiredException; import org.acegisecurity.CredentialsExpiredException;
import org.acegisecurity.DisabledException; import org.acegisecurity.DisabledException;
import org.acegisecurity.LockedException; import org.acegisecurity.LockedException;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.AuthenticationProvider; import org.acegisecurity.providers.AuthenticationProvider;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.providers.dao.cache.NullUserCache; import org.acegisecurity.providers.dao.cache.NullUserCache;
import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.userdetails.UserDetails;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
@ -38,7 +39,7 @@ import org.springframework.util.Assert;
/** /**
* A base {@link AuthenticationProvider} that allows subclasses to override and * A base {@link AuthenticationProvider} that allows subclasses to override and
* work with {@link org.acegisecurity.UserDetails} objects. The class is * work with {@link org.acegisecurity.userdetails.UserDetails} objects. The class is
* designed to respond to {@link UsernamePasswordAuthenticationToken} * designed to respond to {@link UsernamePasswordAuthenticationToken}
* authentication requests. * authentication requests.
* *
@ -63,8 +64,8 @@ import org.springframework.util.Assert;
* Caching is handled via the <code>UserDetails</code> object being placed in * Caching is handled via the <code>UserDetails</code> object being placed in
* the {@link UserCache}. This ensures that subsequent requests with the same * the {@link UserCache}. This ensures that subsequent requests with the same
* username can be validated without needing to query the {@link * username can be validated without needing to query the {@link
* AuthenticationDao}. It should be noted that if a user appears to present an * UserDetailsService}. It should be noted that if a user appears to present an
* incorrect password, the {@link AuthenticationDao} will be queried to * incorrect password, the {@link UserDetailsService} will be queried to
* confirm the most up-to-date password was used for comparison. * confirm the most up-to-date password was used for comparison.
* </p> * </p>
*/ */

View File

@ -18,12 +18,14 @@ package org.acegisecurity.providers.dao;
import org.acegisecurity.AuthenticationException; import org.acegisecurity.AuthenticationException;
import org.acegisecurity.AuthenticationServiceException; import org.acegisecurity.AuthenticationServiceException;
import org.acegisecurity.BadCredentialsException; import org.acegisecurity.BadCredentialsException;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.AuthenticationProvider; import org.acegisecurity.providers.AuthenticationProvider;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.providers.encoding.PasswordEncoder; import org.acegisecurity.providers.encoding.PasswordEncoder;
import org.acegisecurity.providers.encoding.PlaintextPasswordEncoder; import org.acegisecurity.providers.encoding.PlaintextPasswordEncoder;
import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
@ -32,13 +34,13 @@ import org.springframework.util.Assert;
/** /**
* An {@link AuthenticationProvider} implementation that retrieves user details * An {@link AuthenticationProvider} implementation that retrieves user details
* from an {@link AuthenticationDao}. * from an {@link UserDetailsService}.
*/ */
public class DaoAuthenticationProvider public class DaoAuthenticationProvider
extends AbstractUserDetailsAuthenticationProvider { extends AbstractUserDetailsAuthenticationProvider {
//~ Instance fields ======================================================== //~ Instance fields ========================================================
private AuthenticationDao authenticationDao; private UserDetailsService authenticationDao;
private PasswordEncoder passwordEncoder = new PlaintextPasswordEncoder(); private PasswordEncoder passwordEncoder = new PlaintextPasswordEncoder();
private SaltSource saltSource; private SaltSource saltSource;
private boolean hideUserNotFoundExceptions = true; private boolean hideUserNotFoundExceptions = true;
@ -67,7 +69,7 @@ public class DaoAuthenticationProvider
"An Authentication DAO must be set"); "An Authentication DAO must be set");
} }
public AuthenticationDao getAuthenticationDao() { public UserDetailsService getAuthenticationDao() {
return authenticationDao; return authenticationDao;
} }
@ -111,7 +113,7 @@ public class DaoAuthenticationProvider
return loadedUser; return loadedUser;
} }
public void setAuthenticationDao(AuthenticationDao authenticationDao) { public void setAuthenticationDao(UserDetailsService authenticationDao) {
this.authenticationDao = authenticationDao; this.authenticationDao = authenticationDao;
} }

View File

@ -15,7 +15,7 @@
package org.acegisecurity.providers.dao; package org.acegisecurity.providers.dao;
import org.acegisecurity.UserDetails; import org.acegisecurity.userdetails.UserDetails;
/** /**

View File

@ -15,7 +15,8 @@
package org.acegisecurity.providers.dao; package org.acegisecurity.providers.dao;
import org.acegisecurity.UserDetails; import org.acegisecurity.userdetails.User;
import org.acegisecurity.userdetails.UserDetails;
/** /**

View File

@ -15,8 +15,8 @@
package org.acegisecurity.providers.dao.cache; package org.acegisecurity.providers.dao.cache;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.UserCache; import org.acegisecurity.providers.dao.UserCache;
import org.acegisecurity.userdetails.UserDetails;
import net.sf.ehcache.Cache; import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheException; import net.sf.ehcache.CacheException;

View File

@ -15,8 +15,8 @@
package org.acegisecurity.providers.dao.cache; package org.acegisecurity.providers.dao.cache;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.UserCache; import org.acegisecurity.providers.dao.UserCache;
import org.acegisecurity.userdetails.UserDetails;
/** /**

View File

@ -16,8 +16,8 @@
package org.acegisecurity.providers.dao.salt; package org.acegisecurity.providers.dao.salt;
import org.acegisecurity.AuthenticationServiceException; import org.acegisecurity.AuthenticationServiceException;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.SaltSource; import org.acegisecurity.providers.dao.SaltSource;
import org.acegisecurity.userdetails.UserDetails;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;

View File

@ -15,8 +15,8 @@
package org.acegisecurity.providers.dao.salt; package org.acegisecurity.providers.dao.salt;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.SaltSource; import org.acegisecurity.providers.dao.SaltSource;
import org.acegisecurity.userdetails.UserDetails;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;

View File

@ -16,7 +16,7 @@
package org.acegisecurity.providers.jaas; package org.acegisecurity.providers.jaas;
import org.acegisecurity.Authentication; import org.acegisecurity.Authentication;
import org.acegisecurity.UserDetails; import org.acegisecurity.userdetails.UserDetails;
import java.io.IOException; import java.io.IOException;

View File

@ -18,10 +18,10 @@ package org.acegisecurity.providers.x509;
import org.acegisecurity.Authentication; import org.acegisecurity.Authentication;
import org.acegisecurity.AuthenticationException; import org.acegisecurity.AuthenticationException;
import org.acegisecurity.BadCredentialsException; import org.acegisecurity.BadCredentialsException;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.AuthenticationProvider; import org.acegisecurity.providers.AuthenticationProvider;
import org.acegisecurity.providers.x509.cache.NullX509UserCache; import org.acegisecurity.providers.x509.cache.NullX509UserCache;
import org.acegisecurity.userdetails.UserDetails;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;

View File

@ -15,8 +15,8 @@
package org.acegisecurity.providers.x509; package org.acegisecurity.providers.x509;
import org.acegisecurity.UserDetails;
import org.acegisecurity.AuthenticationException; import org.acegisecurity.AuthenticationException;
import org.acegisecurity.userdetails.UserDetails;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;

View File

@ -15,7 +15,7 @@
package org.acegisecurity.providers.x509; package org.acegisecurity.providers.x509;
import org.acegisecurity.UserDetails; import org.acegisecurity.userdetails.UserDetails;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;

View File

@ -15,8 +15,8 @@
package org.acegisecurity.providers.x509.cache; package org.acegisecurity.providers.x509.cache;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.x509.X509UserCache; import org.acegisecurity.providers.x509.X509UserCache;
import org.acegisecurity.userdetails.UserDetails;
import net.sf.ehcache.Cache; import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheException; import net.sf.ehcache.CacheException;

View File

@ -1,7 +1,7 @@
package org.acegisecurity.providers.x509.cache; package org.acegisecurity.providers.x509.cache;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.x509.X509UserCache; import org.acegisecurity.providers.x509.X509UserCache;
import org.acegisecurity.userdetails.UserDetails;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;

View File

@ -17,10 +17,10 @@ package org.acegisecurity.providers.x509.populator;
import org.acegisecurity.AuthenticationException; import org.acegisecurity.AuthenticationException;
import org.acegisecurity.BadCredentialsException; import org.acegisecurity.BadCredentialsException;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.AuthenticationDao;
import org.acegisecurity.providers.x509.X509AuthoritiesPopulator; import org.acegisecurity.providers.x509.X509AuthoritiesPopulator;
import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.userdetails.UserDetails;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -40,7 +40,7 @@ import java.security.cert.X509Certificate;
/** /**
* Populates the X509 authorities via an {@link * Populates the X509 authorities via an {@link
* org.acegisecurity.providers.dao.AuthenticationDao}. * org.acegisecurity.userdetails.UserDetailsService}.
*/ */
public class DaoX509AuthoritiesPopulator implements X509AuthoritiesPopulator, public class DaoX509AuthoritiesPopulator implements X509AuthoritiesPopulator,
InitializingBean, MessageSourceAware { InitializingBean, MessageSourceAware {
@ -50,7 +50,7 @@ public class DaoX509AuthoritiesPopulator implements X509AuthoritiesPopulator,
//~ Instance fields ======================================================== //~ Instance fields ========================================================
private AuthenticationDao authenticationDao; private UserDetailsService authenticationDao;
protected MessageSourceAccessor messages; protected MessageSourceAccessor messages;
private Pattern subjectDNPattern; private Pattern subjectDNPattern;
private String subjectDNRegex = "CN=(.*?),"; private String subjectDNRegex = "CN=(.*?),";
@ -97,7 +97,7 @@ public class DaoX509AuthoritiesPopulator implements X509AuthoritiesPopulator,
return this.authenticationDao.loadUserByUsername(userName); return this.authenticationDao.loadUserByUsername(userName);
} }
public void setAuthenticationDao(AuthenticationDao authenticationDao) { public void setAuthenticationDao(UserDetailsService authenticationDao) {
this.authenticationDao = authenticationDao; this.authenticationDao = authenticationDao;
} }

View File

@ -57,7 +57,7 @@ import java.util.Vector;
* use when using preexisting role names without a prefix, and no ability * use when using preexisting role names without a prefix, and no ability
* exists to prefix them with a role prefix on reading them in, such as * exists to prefix them with a role prefix on reading them in, such as
* provided for example in {@link * provided for example in {@link
* org.acegisecurity.providers.dao.jdbc.JdbcDaoImpl}. * org.acegisecurity.userdetails.jdbc.JdbcDaoImpl}.
* </p> * </p>
* *
* @author Ben Alex * @author Ben Alex

View File

@ -16,10 +16,10 @@
package org.acegisecurity.taglibs.authz; package org.acegisecurity.taglibs.authz;
import org.acegisecurity.Authentication; import org.acegisecurity.Authentication;
import org.acegisecurity.UserDetails;
import org.acegisecurity.context.SecurityContext; import org.acegisecurity.context.SecurityContext;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.userdetails.UserDetails;
import java.io.IOException; import java.io.IOException;

View File

@ -18,18 +18,18 @@ package org.acegisecurity.ui.digestauth;
import org.acegisecurity.AuthenticationException; import org.acegisecurity.AuthenticationException;
import org.acegisecurity.AuthenticationServiceException; import org.acegisecurity.AuthenticationServiceException;
import org.acegisecurity.BadCredentialsException; import org.acegisecurity.BadCredentialsException;
import org.acegisecurity.UserDetails;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.providers.dao.AuthenticationDao;
import org.acegisecurity.providers.dao.UserCache; import org.acegisecurity.providers.dao.UserCache;
import org.acegisecurity.providers.dao.UsernameNotFoundException;
import org.acegisecurity.providers.dao.cache.NullUserCache; import org.acegisecurity.providers.dao.cache.NullUserCache;
import org.acegisecurity.ui.WebAuthenticationDetails; import org.acegisecurity.ui.WebAuthenticationDetails;
import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.acegisecurity.util.StringSplitUtils; import org.acegisecurity.util.StringSplitUtils;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
@ -120,7 +120,7 @@ public class DigestProcessingFilter implements Filter, InitializingBean,
//~ Instance fields ======================================================== //~ Instance fields ========================================================
private AuthenticationDao authenticationDao; private UserDetailsService authenticationDao;
private DigestProcessingFilterEntryPoint authenticationEntryPoint; private DigestProcessingFilterEntryPoint authenticationEntryPoint;
protected MessageSourceAccessor messages; protected MessageSourceAccessor messages;
private UserCache userCache = new NullUserCache(); private UserCache userCache = new NullUserCache();
@ -460,7 +460,7 @@ public class DigestProcessingFilter implements Filter, InitializingBean,
return digestMd5; return digestMd5;
} }
public AuthenticationDao getAuthenticationDao() { public UserDetailsService getAuthenticationDao() {
return authenticationDao; return authenticationDao;
} }
@ -474,7 +474,7 @@ public class DigestProcessingFilter implements Filter, InitializingBean,
public void init(FilterConfig ignored) throws ServletException {} public void init(FilterConfig ignored) throws ServletException {}
public void setAuthenticationDao(AuthenticationDao authenticationDao) { public void setAuthenticationDao(UserDetailsService authenticationDao) {
this.authenticationDao = authenticationDao; this.authenticationDao = authenticationDao;
} }

View File

@ -16,10 +16,10 @@
package org.acegisecurity.ui.rememberme; package org.acegisecurity.ui.rememberme;
import org.acegisecurity.Authentication; import org.acegisecurity.Authentication;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.AuthenticationDao;
import org.acegisecurity.providers.dao.UsernameNotFoundException;
import org.acegisecurity.providers.rememberme.RememberMeAuthenticationToken; import org.acegisecurity.providers.rememberme.RememberMeAuthenticationToken;
import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
@ -57,10 +57,10 @@ import javax.servlet.http.HttpServletResponse;
* </p> * </p>
* *
* <p> * <p>
* An {@link org.acegisecurity.providers.dao.AuthenticationDao} is required * An {@link org.acegisecurity.userdetails.UserDetailsService} is required
* by this implementation, so that it can construct a valid * by this implementation, so that it can construct a valid
* <code>Authentication</code> from the returned {@link * <code>Authentication</code> from the returned {@link
* org.acegisecurity.UserDetails}. This is also necessary so that the * org.acegisecurity.userdetails.UserDetails}. This is also necessary so that the
* user's password is available and can be checked as part of the encoded * user's password is available and can be checked as part of the encoded
* cookie. * cookie.
* </p> * </p>
@ -112,18 +112,18 @@ public class TokenBasedRememberMeServices implements RememberMeServices,
//~ Instance fields ======================================================== //~ Instance fields ========================================================
private AuthenticationDao authenticationDao; private UserDetailsService authenticationDao;
private String key; private String key;
private String parameter = DEFAULT_PARAMETER; private String parameter = DEFAULT_PARAMETER;
private long tokenValiditySeconds = 1209600; // 14 days private long tokenValiditySeconds = 1209600; // 14 days
//~ Methods ================================================================ //~ Methods ================================================================
public void setAuthenticationDao(AuthenticationDao authenticationDao) { public void setAuthenticationDao(UserDetailsService authenticationDao) {
this.authenticationDao = authenticationDao; this.authenticationDao = authenticationDao;
} }
public AuthenticationDao getAuthenticationDao() { public UserDetailsService getAuthenticationDao() {
return authenticationDao; return authenticationDao;
} }

View File

@ -23,17 +23,17 @@ import org.acegisecurity.CredentialsExpiredException;
import org.acegisecurity.DisabledException; import org.acegisecurity.DisabledException;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.LockedException; import org.acegisecurity.LockedException;
import org.acegisecurity.UserDetails;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.event.authentication.AuthenticationSwitchUserEvent; import org.acegisecurity.event.authentication.AuthenticationSwitchUserEvent;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.providers.dao.AuthenticationDao;
import org.acegisecurity.providers.dao.UsernameNotFoundException;
import org.acegisecurity.ui.WebAuthenticationDetails; import org.acegisecurity.ui.WebAuthenticationDetails;
import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -131,7 +131,7 @@ public class SwitchUserProcessingFilter implements Filter, InitializingBean,
// ~ Instance fields // ~ Instance fields
// ======================================================== // ========================================================
private AuthenticationDao authenticationDao; private UserDetailsService authenticationDao;
protected MessageSourceAccessor messages; protected MessageSourceAccessor messages;
private String exitUserUrl = "/j_acegi_exit_user"; private String exitUserUrl = "/j_acegi_exit_user";
private String switchUserUrl = "/j_acegi_switch_user"; private String switchUserUrl = "/j_acegi_switch_user";
@ -492,7 +492,7 @@ public class SwitchUserProcessingFilter implements Filter, InitializingBean,
* authentication dao * authentication dao
*/ */
public void setAuthenticationDao( public void setAuthenticationDao(
AuthenticationDao authenticationDao) { UserDetailsService authenticationDao) {
this.authenticationDao = authenticationDao; this.authenticationDao = authenticationDao;
} }

View File

@ -13,35 +13,41 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao; package org.acegisecurity.userdetails;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.UserDetails; import org.acegisecurity.providers.dao.DaoAuthenticationProvider;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
* Models core user information retieved by an {@link AuthenticationDao}. * Models core user information retieved by an {@link UserDetailsService}.
* *
* <P> * <P>
* Implemented with value object semantics (immutable after construction, like * Implemented with value object semantics (immutable after construction, like a
* a <code>String</code>). Developers may use this class directly, subclass * <code>String</code>). Developers may use this class directly, subclass it,
* it, or write their own {@link UserDetails} implementation from scratch. * or write their own {@link UserDetails} implementation from scratch.
* </p> * </p>
*/ */
public class User implements UserDetails { public class User implements UserDetails {
//~ Instance fields ======================================================== // ~ Instance fields
// ========================================================
private String password; private String password;
private String username; private String username;
private GrantedAuthority[] authorities; private GrantedAuthority[] authorities;
private boolean accountNonExpired; private boolean accountNonExpired;
private boolean accountNonLocked; private boolean accountNonLocked;
private boolean credentialsNonExpired; private boolean credentialsNonExpired;
private boolean enabled; private boolean enabled;
//~ Constructors =========================================================== // ~ Constructors
// ===========================================================
protected User() { protected User() {
throw new IllegalArgumentException("Cannot use default constructor"); throw new IllegalArgumentException("Cannot use default constructor");
@ -51,17 +57,22 @@ public class User implements UserDetails {
* Construct the <code>User</code> with the details required by {@link * Construct the <code>User</code> with the details required by {@link
* DaoAuthenticationProvider}. * DaoAuthenticationProvider}.
* *
* @param username the username presented to the * @param username
* the username presented to the
* <code>DaoAuthenticationProvider</code> * <code>DaoAuthenticationProvider</code>
* @param password the password that should be presented to the * @param password
* the password that should be presented to the
* <code>DaoAuthenticationProvider</code> * <code>DaoAuthenticationProvider</code>
* @param enabled set to <code>true</code> if the user is enabled * @param enabled
* @param authorities the authorities that should be granted to the caller * set to <code>true</code> if the user is enabled
* if they presented the correct username and password and the user * @param authorities
* is enabled * the authorities that should be granted to the caller if they
* presented the correct username and password and the user is
* enabled
* *
* @throws IllegalArgumentException if a <code>null</code> value was passed * @throws IllegalArgumentException
* either as a parameter or as an element in the * if a <code>null</code> value was passed either as a
* parameter or as an element in the
* <code>GrantedAuthority[]</code> array * <code>GrantedAuthority[]</code> array
* *
* @deprecated use new constructor with extended properties (this * @deprecated use new constructor with extended properties (this
@ -76,21 +87,26 @@ public class User implements UserDetails {
* Construct the <code>User</code> with the details required by {@link * Construct the <code>User</code> with the details required by {@link
* DaoAuthenticationProvider}. * DaoAuthenticationProvider}.
* *
* @param username the username presented to the * @param username
* the username presented to the
* <code>DaoAuthenticationProvider</code> * <code>DaoAuthenticationProvider</code>
* @param password the password that should be presented to the * @param password
* the password that should be presented to the
* <code>DaoAuthenticationProvider</code> * <code>DaoAuthenticationProvider</code>
* @param enabled set to <code>true</code> if the user is enabled * @param enabled
* @param accountNonExpired set to <code>true</code> if the account has not * set to <code>true</code> if the user is enabled
* expired * @param accountNonExpired
* @param credentialsNonExpired set to <code>true</code> if the credentials * set to <code>true</code> if the account has not expired
* have not expired * @param credentialsNonExpired
* @param authorities the authorities that should be granted to the caller * set to <code>true</code> if the credentials have not expired
* if they presented the correct username and password and the user * @param authorities
* is enabled * the authorities that should be granted to the caller if they
* presented the correct username and password and the user is
* enabled
* *
* @throws IllegalArgumentException if a <code>null</code> value was passed * @throws IllegalArgumentException
* either as a parameter or as an element in the * if a <code>null</code> value was passed either as a
* parameter or as an element in the
* <code>GrantedAuthority[]</code> array * <code>GrantedAuthority[]</code> array
* *
* @deprecated use new constructor with extended properties (this * @deprecated use new constructor with extended properties (this
@ -107,23 +123,28 @@ public class User implements UserDetails {
* Construct the <code>User</code> with the details required by {@link * Construct the <code>User</code> with the details required by {@link
* DaoAuthenticationProvider}. * DaoAuthenticationProvider}.
* *
* @param username the username presented to the * @param username
* the username presented to the
* <code>DaoAuthenticationProvider</code> * <code>DaoAuthenticationProvider</code>
* @param password the password that should be presented to the * @param password
* the password that should be presented to the
* <code>DaoAuthenticationProvider</code> * <code>DaoAuthenticationProvider</code>
* @param enabled set to <code>true</code> if the user is enabled * @param enabled
* @param accountNonExpired set to <code>true</code> if the account has not * set to <code>true</code> if the user is enabled
* expired * @param accountNonExpired
* @param credentialsNonExpired set to <code>true</code> if the credentials * set to <code>true</code> if the account has not expired
* have not expired * @param credentialsNonExpired
* @param accountNonLocked set to <code>true</code> if the account is not * set to <code>true</code> if the credentials have not expired
* locked * @param accountNonLocked
* @param authorities the authorities that should be granted to the caller * set to <code>true</code> if the account is not locked
* if they presented the correct username and password and the user * @param authorities
* is enabled * the authorities that should be granted to the caller if they
* presented the correct username and password and the user is
* enabled
* *
* @throws IllegalArgumentException if a <code>null</code> value was passed * @throws IllegalArgumentException
* either as a parameter or as an element in the * if a <code>null</code> value was passed either as a
* parameter or as an element in the
* <code>GrantedAuthority[]</code> array * <code>GrantedAuthority[]</code> array
*/ */
public User(String username, String password, boolean enabled, public User(String username, String password, boolean enabled,
@ -144,7 +165,8 @@ public class User implements UserDetails {
setAuthorities(authorities); setAuthorities(authorities);
} }
//~ Methods ================================================================ // ~ Methods
// ================================================================
public boolean equals(Object rhs) { public boolean equals(Object rhs) {
if (!(rhs instanceof User) || (rhs == null)) { if (!(rhs instanceof User) || (rhs == null)) {
@ -153,7 +175,8 @@ public class User implements UserDetails {
User user = (User) rhs; User user = (User) rhs;
// We rely on constructor to guarantee any User has non-null and >0 authorities // We rely on constructor to guarantee any User has non-null and >0
// authorities
if (user.getAuthorities().length != this.getAuthorities().length) { if (user.getAuthorities().length != this.getAuthorities().length) {
return false; return false;
} }
@ -169,8 +192,9 @@ public class User implements UserDetails {
&& this.getUsername().equals(user.getUsername()) && this.getUsername().equals(user.getUsername())
&& (this.isAccountNonExpired() == user.isAccountNonExpired()) && (this.isAccountNonExpired() == user.isAccountNonExpired())
&& (this.isAccountNonLocked() == user.isAccountNonLocked()) && (this.isAccountNonLocked() == user.isAccountNonLocked())
&& (this.isCredentialsNonExpired() == user.isCredentialsNonExpired()) && (this.isCredentialsNonExpired() == user
&& (this.isEnabled() == user.isEnabled())); .isCredentialsNonExpired()) && (this.isEnabled() == user
.isEnabled()));
} }
public GrantedAuthority[] getAuthorities() { public GrantedAuthority[] getAuthorities() {
@ -202,11 +226,16 @@ public class User implements UserDetails {
} }
protected void setAuthorities(GrantedAuthority[] authorities) { protected void setAuthorities(GrantedAuthority[] authorities) {
Assert.notNull(authorities, "Cannot pass a null GrantedAuthority array"); Assert
.notNull(authorities,
"Cannot pass a null GrantedAuthority array");
for (int i = 0; i < authorities.length; i++) { for (int i = 0; i < authorities.length; i++) {
Assert.notNull(authorities[i], Assert
"Granted authority element " + i .notNull(
authorities[i],
"Granted authority element "
+ i
+ " is null - GrantedAuthority[] cannot contain any null elements"); + " is null - GrantedAuthority[] cannot contain any null elements");
} }
@ -220,7 +249,9 @@ public class User implements UserDetails {
sb.append("Password: [PROTECTED]; "); sb.append("Password: [PROTECTED]; ");
sb.append("Enabled: " + this.enabled + "; "); sb.append("Enabled: " + this.enabled + "; ");
sb.append("AccountNonExpired: " + this.accountNonExpired + "; "); sb.append("AccountNonExpired: " + this.accountNonExpired + "; ");
sb.append("credentialsNonExpired: " + this.credentialsNonExpired + "; "); sb
.append("credentialsNonExpired: " + this.credentialsNonExpired
+ "; ");
sb.append("AccountNonLocked: " + this.accountNonLocked + "; "); sb.append("AccountNonLocked: " + this.accountNonLocked + "; ");
if (this.getAuthorities() != null) { if (this.getAuthorities() != null) {

View File

@ -13,10 +13,13 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity; package org.acegisecurity.userdetails;
import java.io.Serializable; import java.io.Serializable;
import org.acegisecurity.Authentication;
import org.acegisecurity.GrantedAuthority;
/** /**
* Provides core user information. * Provides core user information.

View File

@ -13,10 +13,9 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao; package org.acegisecurity.userdetails;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.DaoAuthenticationProvider;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
@ -32,7 +31,7 @@ import org.springframework.dao.DataAccessException;
* @author Ben Alex * @author Ben Alex
* @version $Id$ * @version $Id$
*/ */
public interface AuthenticationDao { public interface UserDetailsService {
//~ Methods ================================================================ //~ Methods ================================================================
/** /**

View File

@ -13,13 +13,13 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao; package org.acegisecurity.userdetails;
import org.acegisecurity.BadCredentialsException; import org.acegisecurity.BadCredentialsException;
/** /**
* Thrown if an {@link AuthenticationDao} implementation cannot locate a {@link * Thrown if an {@link UserDetailsService} implementation cannot locate a {@link
* User} by its username. * User} by its username.
* *
* @author Ben Alex * @author Ben Alex

View File

@ -13,34 +13,29 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao.jdbc; package org.acegisecurity.userdetails.jdbc;
import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.AuthenticationDao;
import org.acegisecurity.providers.dao.User;
import org.acegisecurity.providers.dao.UsernameNotFoundException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContextException;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.jdbc.object.MappingSqlQuery;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Types; import java.sql.Types;
import java.util.List; import java.util.List;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.userdetails.User;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContextException;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.jdbc.object.MappingSqlQuery;
/** /**
* <p> * <p>
@ -70,7 +65,7 @@ import javax.sql.DataSource;
* @author colin sampaleanu * @author colin sampaleanu
* @version $Id$ * @version $Id$
*/ */
public class JdbcDaoImpl extends JdbcDaoSupport implements AuthenticationDao { public class JdbcDaoImpl extends JdbcDaoSupport implements UserDetailsService {
//~ Static fields/initializers ============================================= //~ Static fields/initializers =============================================
public static final String DEF_USERS_BY_USERNAME_QUERY = "SELECT username,password,enabled FROM users WHERE username = ?"; public static final String DEF_USERS_BY_USERNAME_QUERY = "SELECT username,password,enabled FROM users WHERE username = ?";

View File

@ -13,20 +13,17 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao.memory; package org.acegisecurity.userdetails.memory;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.AuthenticationDao;
import org.acegisecurity.providers.dao.UsernameNotFoundException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.dao.DataAccessException;
import org.springframework.util.Assert;
import java.util.Properties; import java.util.Properties;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.dao.DataAccessException;
import org.springframework.util.Assert;
/** /**
* Retrieves user details from an in-memory list created by the bean context. * Retrieves user details from an in-memory list created by the bean context.
@ -34,7 +31,7 @@ import java.util.Properties;
* @author Ben Alex * @author Ben Alex
* @version $Id$ * @version $Id$
*/ */
public class InMemoryDaoImpl implements AuthenticationDao, InitializingBean { public class InMemoryDaoImpl implements UserDetailsService, InitializingBean {
//~ Instance fields ======================================================== //~ Instance fields ========================================================
private UserMap userMap; private UserMap userMap;

View File

@ -13,14 +13,14 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao.memory; package org.acegisecurity.userdetails.memory;
import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl;
/** /**
* Used by {@link InMemoryDaoImpl} to temporarily store the attributes * Used by {@link InMemoryDaoImpl} to temporarily store the attributes

View File

@ -13,14 +13,13 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao.memory; package org.acegisecurity.userdetails.memory;
import org.acegisecurity.GrantedAuthorityImpl;
import org.springframework.util.StringUtils;
import java.beans.PropertyEditorSupport; import java.beans.PropertyEditorSupport;
import org.acegisecurity.GrantedAuthorityImpl;
import org.springframework.util.StringUtils;
/** /**
* Property editor that creates a {@link UserAttribute} from a comma separated * Property editor that creates a {@link UserAttribute} from a comma separated

View File

@ -13,19 +13,18 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao.memory; package org.acegisecurity.userdetails.memory;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.User;
import org.acegisecurity.providers.dao.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.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;
/** /**
* Used by {@link InMemoryDaoImpl} to store a list of users and their * Used by {@link InMemoryDaoImpl} to store a list of users and their

View File

@ -13,18 +13,16 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao.memory; package org.acegisecurity.userdetails.memory;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.User;
import org.springframework.beans.propertyeditors.PropertiesEditor;
import java.beans.PropertyEditorSupport; import java.beans.PropertyEditorSupport;
import java.util.Iterator; import java.util.Iterator;
import java.util.Properties; import java.util.Properties;
import org.acegisecurity.userdetails.User;
import org.acegisecurity.userdetails.UserDetails;
import org.springframework.beans.propertyeditors.PropertiesEditor;
/** /**
* Property editor to assist with the setup of a {@link UserMap}. * Property editor to assist with the setup of a {@link UserMap}.

View File

@ -49,7 +49,7 @@ import java.util.Iterator;
* some use when using preexisting role names without a prefix, and no ability * some use when using preexisting role names without a prefix, and no ability
* exists to prefix them with a role prefix on reading them in, such as * exists to prefix them with a role prefix on reading them in, such as
* provided for example in {@link * provided for example in {@link
* org.acegisecurity.providers.dao.jdbc.JdbcDaoImpl}. * org.acegisecurity.userdetails.jdbc.JdbcDaoImpl}.
* </p> * </p>
* *
* <p> * <p>

View File

@ -18,8 +18,8 @@ package org.acegisecurity.wrapper;
import org.acegisecurity.Authentication; import org.acegisecurity.Authentication;
import org.acegisecurity.AuthenticationTrustResolver; import org.acegisecurity.AuthenticationTrustResolver;
import org.acegisecurity.AuthenticationTrustResolverImpl; import org.acegisecurity.AuthenticationTrustResolverImpl;
import org.acegisecurity.UserDetails;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.userdetails.UserDetails;
import java.security.Principal; import java.security.Principal;

View File

@ -21,7 +21,7 @@ import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.acl.AclEntry; import org.acegisecurity.acl.AclEntry;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.providers.dao.User; import org.acegisecurity.userdetails.User;
/** /**

View File

@ -23,7 +23,7 @@ import org.acegisecurity.MockFilterConfig;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.context.SecurityContextImpl; import org.acegisecurity.context.SecurityContextImpl;
import org.acegisecurity.providers.TestingAuthenticationToken; import org.acegisecurity.providers.TestingAuthenticationToken;
import org.acegisecurity.providers.dao.memory.UserAttribute; import org.acegisecurity.userdetails.memory.UserAttribute;
import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockHttpServletResponse;

View File

@ -22,12 +22,12 @@ import org.acegisecurity.AuthenticationException;
import org.acegisecurity.BadCredentialsException; import org.acegisecurity.BadCredentialsException;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.TestingAuthenticationToken; import org.acegisecurity.providers.TestingAuthenticationToken;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.providers.cas.ticketvalidator.AbstractTicketValidator; import org.acegisecurity.providers.cas.ticketvalidator.AbstractTicketValidator;
import org.acegisecurity.providers.dao.User;
import org.acegisecurity.ui.cas.CasProcessingFilter; import org.acegisecurity.ui.cas.CasProcessingFilter;
import org.acegisecurity.userdetails.User;
import org.acegisecurity.userdetails.UserDetails;
import org.springframework.context.support.StaticMessageSource; import org.springframework.context.support.StaticMessageSource;
import java.util.HashMap; import java.util.HashMap;

View File

@ -19,9 +19,9 @@ import junit.framework.TestCase;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.providers.dao.User; import org.acegisecurity.userdetails.User;
import org.acegisecurity.userdetails.UserDetails;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;

View File

@ -21,7 +21,7 @@ import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.MockApplicationContext; import org.acegisecurity.MockApplicationContext;
import org.acegisecurity.providers.cas.CasAuthenticationToken; import org.acegisecurity.providers.cas.CasAuthenticationToken;
import org.acegisecurity.providers.dao.User; import org.acegisecurity.userdetails.User;
import net.sf.ehcache.Cache; import net.sf.ehcache.Cache;

View File

@ -19,10 +19,10 @@ import junit.framework.TestCase;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.UserDetails; import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.providers.dao.AuthenticationDao; import org.acegisecurity.userdetails.User;
import org.acegisecurity.providers.dao.User; import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.providers.dao.UsernameNotFoundException; import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.dao.DataRetrievalFailureException; import org.springframework.dao.DataRetrievalFailureException;
@ -111,7 +111,7 @@ public class DaoCasAuthoritiesPopulatorTests extends TestCase {
public void testGettersSetters() { public void testGettersSetters() {
DaoCasAuthoritiesPopulator populator = new DaoCasAuthoritiesPopulator(); DaoCasAuthoritiesPopulator populator = new DaoCasAuthoritiesPopulator();
AuthenticationDao dao = new MockAuthenticationDaoUserMarissa(); UserDetailsService dao = new MockAuthenticationDaoUserMarissa();
populator.setAuthenticationDao(dao); populator.setAuthenticationDao(dao);
assertEquals(dao, populator.getAuthenticationDao()); assertEquals(dao, populator.getAuthenticationDao());
} }
@ -119,7 +119,7 @@ public class DaoCasAuthoritiesPopulatorTests extends TestCase {
//~ Inner Classes ========================================================== //~ Inner Classes ==========================================================
private class MockAuthenticationDaoSimulateBackendError private class MockAuthenticationDaoSimulateBackendError
implements AuthenticationDao { implements UserDetailsService {
public long getRefreshDuration() { public long getRefreshDuration() {
return 0; return 0;
} }
@ -131,7 +131,7 @@ public class DaoCasAuthoritiesPopulatorTests extends TestCase {
} }
} }
private class MockAuthenticationDaoUserMarissa implements AuthenticationDao { private class MockAuthenticationDaoUserMarissa implements UserDetailsService {
public long getRefreshDuration() { public long getRefreshDuration() {
return 0; return 0;
} }

View File

@ -26,13 +26,16 @@ import org.acegisecurity.DisabledException;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.LockedException; import org.acegisecurity.LockedException;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.TestingAuthenticationToken; import org.acegisecurity.providers.TestingAuthenticationToken;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache; import org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache;
import org.acegisecurity.providers.dao.cache.NullUserCache; import org.acegisecurity.providers.dao.cache.NullUserCache;
import org.acegisecurity.providers.dao.salt.SystemWideSaltSource; import org.acegisecurity.providers.dao.salt.SystemWideSaltSource;
import org.acegisecurity.providers.encoding.ShaPasswordEncoder; import org.acegisecurity.providers.encoding.ShaPasswordEncoder;
import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.userdetails.User;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.springframework.context.support.StaticMessageSource; import org.springframework.context.support.StaticMessageSource;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
@ -461,7 +464,7 @@ public class DaoAuthenticationProviderTests extends TestCase {
public void testStartupSuccess() throws Exception { public void testStartupSuccess() throws Exception {
DaoAuthenticationProvider provider = new DaoAuthenticationProvider(); DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
provider.setMessageSource(new StaticMessageSource()); provider.setMessageSource(new StaticMessageSource());
AuthenticationDao dao = new MockAuthenticationDaoUserMarissa(); UserDetailsService dao = new MockAuthenticationDaoUserMarissa();
provider.setAuthenticationDao(dao); provider.setAuthenticationDao(dao);
provider.setUserCache(new MockUserCache()); provider.setUserCache(new MockUserCache());
assertEquals(dao, provider.getAuthenticationDao()); assertEquals(dao, provider.getAuthenticationDao());
@ -478,7 +481,7 @@ public class DaoAuthenticationProviderTests extends TestCase {
//~ Inner Classes ========================================================== //~ Inner Classes ==========================================================
private class MockAuthenticationDaoReturnsNull implements AuthenticationDao { private class MockAuthenticationDaoReturnsNull implements UserDetailsService {
public UserDetails loadUserByUsername(String username) public UserDetails loadUserByUsername(String username)
throws UsernameNotFoundException, DataAccessException { throws UsernameNotFoundException, DataAccessException {
return null; return null;
@ -486,7 +489,7 @@ public class DaoAuthenticationProviderTests extends TestCase {
} }
private class MockAuthenticationDaoSimulateBackendError private class MockAuthenticationDaoSimulateBackendError
implements AuthenticationDao { implements UserDetailsService {
public UserDetails loadUserByUsername(String username) public UserDetails loadUserByUsername(String username)
throws UsernameNotFoundException, DataAccessException { throws UsernameNotFoundException, DataAccessException {
throw new DataRetrievalFailureException( throw new DataRetrievalFailureException(
@ -494,7 +497,7 @@ public class DaoAuthenticationProviderTests extends TestCase {
} }
} }
private class MockAuthenticationDaoUserMarissa implements AuthenticationDao { private class MockAuthenticationDaoUserMarissa implements UserDetailsService {
private String password = "koala"; private String password = "koala";
public void setPassword(String password) { public void setPassword(String password) {
@ -515,7 +518,7 @@ public class DaoAuthenticationProviderTests extends TestCase {
} }
private class MockAuthenticationDaoUserMarissaWithSalt private class MockAuthenticationDaoUserMarissaWithSalt
implements AuthenticationDao { implements UserDetailsService {
public UserDetails loadUserByUsername(String username) public UserDetails loadUserByUsername(String username)
throws UsernameNotFoundException, DataAccessException { throws UsernameNotFoundException, DataAccessException {
if ("marissa".equals(username)) { if ("marissa".equals(username)) {
@ -530,7 +533,7 @@ public class DaoAuthenticationProviderTests extends TestCase {
} }
} }
private class MockAuthenticationDaoUserPeter implements AuthenticationDao { private class MockAuthenticationDaoUserPeter implements UserDetailsService {
public UserDetails loadUserByUsername(String username) public UserDetails loadUserByUsername(String username)
throws UsernameNotFoundException, DataAccessException { throws UsernameNotFoundException, DataAccessException {
if ("peter".equals(username)) { if ("peter".equals(username)) {
@ -545,7 +548,7 @@ public class DaoAuthenticationProviderTests extends TestCase {
} }
private class MockAuthenticationDaoUserPeterAccountExpired private class MockAuthenticationDaoUserPeterAccountExpired
implements AuthenticationDao { implements UserDetailsService {
public UserDetails loadUserByUsername(String username) public UserDetails loadUserByUsername(String username)
throws UsernameNotFoundException, DataAccessException { throws UsernameNotFoundException, DataAccessException {
if ("peter".equals(username)) { if ("peter".equals(username)) {
@ -560,7 +563,7 @@ public class DaoAuthenticationProviderTests extends TestCase {
} }
private class MockAuthenticationDaoUserPeterAccountLocked private class MockAuthenticationDaoUserPeterAccountLocked
implements AuthenticationDao { implements UserDetailsService {
public UserDetails loadUserByUsername(String username) public UserDetails loadUserByUsername(String username)
throws UsernameNotFoundException, DataAccessException { throws UsernameNotFoundException, DataAccessException {
if ("peter".equals(username)) { if ("peter".equals(username)) {
@ -575,7 +578,7 @@ public class DaoAuthenticationProviderTests extends TestCase {
} }
private class MockAuthenticationDaoUserPeterCredentialsExpired private class MockAuthenticationDaoUserPeterCredentialsExpired
implements AuthenticationDao { implements UserDetailsService {
public UserDetails loadUserByUsername(String username) public UserDetails loadUserByUsername(String username)
throws UsernameNotFoundException, DataAccessException { throws UsernameNotFoundException, DataAccessException {
if ("peter".equals(username)) { if ("peter".equals(username)) {

View File

@ -20,7 +20,7 @@ import junit.framework.TestCase;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.MockApplicationContext; import org.acegisecurity.MockApplicationContext;
import org.acegisecurity.providers.dao.User; import org.acegisecurity.userdetails.User;
import net.sf.ehcache.Cache; import net.sf.ehcache.Cache;

View File

@ -19,7 +19,7 @@ import junit.framework.TestCase;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.providers.dao.User; import org.acegisecurity.userdetails.User;
/** /**

View File

@ -20,8 +20,8 @@ import junit.framework.TestCase;
import org.acegisecurity.AuthenticationServiceException; import org.acegisecurity.AuthenticationServiceException;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.UserDetails; import org.acegisecurity.userdetails.User;
import org.acegisecurity.providers.dao.User; import org.acegisecurity.userdetails.UserDetails;
/** /**

View File

@ -19,7 +19,8 @@ import junit.framework.TestCase;
import org.acegisecurity.*; import org.acegisecurity.*;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.providers.dao.User; import org.acegisecurity.userdetails.User;
import org.acegisecurity.userdetails.UserDetails;
import org.springframework.context.support.StaticMessageSource; import org.springframework.context.support.StaticMessageSource;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;

View File

@ -20,9 +20,9 @@ import junit.framework.TestCase;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.MockApplicationContext; import org.acegisecurity.MockApplicationContext;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.User;
import org.acegisecurity.providers.x509.X509TestUtils; import org.acegisecurity.providers.x509.X509TestUtils;
import org.acegisecurity.userdetails.User;
import org.acegisecurity.userdetails.UserDetails;
import net.sf.ehcache.Cache; import net.sf.ehcache.Cache;

View File

@ -20,11 +20,11 @@ import junit.framework.TestCase;
import org.acegisecurity.BadCredentialsException; import org.acegisecurity.BadCredentialsException;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.AuthenticationDao;
import org.acegisecurity.providers.dao.User;
import org.acegisecurity.providers.dao.UsernameNotFoundException;
import org.acegisecurity.providers.x509.X509TestUtils; import org.acegisecurity.providers.x509.X509TestUtils;
import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.userdetails.User;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.springframework.context.support.StaticMessageSource; import org.springframework.context.support.StaticMessageSource;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
@ -139,7 +139,7 @@ public class DaoX509AuthoritiesPopulatorTests extends TestCase {
//~ Inner Classes ========================================================== //~ Inner Classes ==========================================================
private class MockAuthenticationDaoMatchesNameOrEmail private class MockAuthenticationDaoMatchesNameOrEmail
implements AuthenticationDao { implements UserDetailsService {
public UserDetails loadUserByUsername(String username) public UserDetails loadUserByUsername(String username)
throws UsernameNotFoundException, DataAccessException { throws UsernameNotFoundException, DataAccessException {
if ("Luke Taylor".equals(username) if ("Luke Taylor".equals(username)

View File

@ -21,7 +21,7 @@ import org.acegisecurity.Authentication;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.providers.TestingAuthenticationToken; import org.acegisecurity.providers.TestingAuthenticationToken;
import org.acegisecurity.providers.dao.User; import org.acegisecurity.userdetails.User;
import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag; import javax.servlet.jsp.tagext.Tag;

View File

@ -20,9 +20,9 @@ import junit.framework.TestCase;
import org.acegisecurity.MockAuthenticationEntryPoint; import org.acegisecurity.MockAuthenticationEntryPoint;
import org.acegisecurity.MockAuthenticationManager; import org.acegisecurity.MockAuthenticationManager;
import org.acegisecurity.MockFilterConfig; import org.acegisecurity.MockFilterConfig;
import org.acegisecurity.UserDetails;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.context.SecurityContextImpl; import org.acegisecurity.context.SecurityContextImpl;
import org.acegisecurity.userdetails.UserDetails;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;

View File

@ -19,15 +19,15 @@ import junit.framework.TestCase;
import org.acegisecurity.DisabledException; import org.acegisecurity.DisabledException;
import org.acegisecurity.MockFilterConfig; import org.acegisecurity.MockFilterConfig;
import org.acegisecurity.UserDetails;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.context.SecurityContextImpl; import org.acegisecurity.context.SecurityContextImpl;
import org.acegisecurity.providers.dao.AuthenticationDao;
import org.acegisecurity.providers.dao.UserCache; import org.acegisecurity.providers.dao.UserCache;
import org.acegisecurity.providers.dao.UsernameNotFoundException;
import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.acegisecurity.util.StringSplitUtils; import org.acegisecurity.util.StringSplitUtils;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
@ -855,7 +855,7 @@ public class DigestProcessingFilterTests extends TestCase {
//~ Inner Classes ========================================================== //~ Inner Classes ==========================================================
private class MockAuthenticationDao implements AuthenticationDao { private class MockAuthenticationDao implements UserDetailsService {
public UserDetails loadUserByUsername(String username) public UserDetails loadUserByUsername(String username)
throws UsernameNotFoundException, DataAccessException { throws UsernameNotFoundException, DataAccessException {
return null; return null;

View File

@ -22,11 +22,11 @@ import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.TestingAuthenticationToken; import org.acegisecurity.providers.TestingAuthenticationToken;
import org.acegisecurity.providers.dao.AuthenticationDao; import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.providers.dao.User; import org.acegisecurity.userdetails.User;
import org.acegisecurity.providers.dao.UsernameNotFoundException; import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
@ -402,7 +402,7 @@ public class TokenBasedRememberMeServicesTests extends TestCase {
//~ Inner Classes ========================================================== //~ Inner Classes ==========================================================
private class MockAuthenticationDao implements AuthenticationDao { private class MockAuthenticationDao implements UserDetailsService {
private UserDetails toReturn; private UserDetails toReturn;
private boolean throwException; private boolean throwException;

View File

@ -23,12 +23,12 @@ import org.acegisecurity.CredentialsExpiredException;
import org.acegisecurity.DisabledException; import org.acegisecurity.DisabledException;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.UserDetails;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.providers.dao.AuthenticationDao; import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.providers.dao.User; import org.acegisecurity.userdetails.User;
import org.acegisecurity.providers.dao.UsernameNotFoundException; import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.acegisecurity.util.MockFilterChain; import org.acegisecurity.util.MockFilterChain;
import org.springframework.context.support.StaticMessageSource; import org.springframework.context.support.StaticMessageSource;
@ -383,7 +383,7 @@ public class SwitchUserProcessingFilterTests extends TestCase {
//~ Inner Classes ========================================================== //~ Inner Classes ==========================================================
private class MockAuthenticationDaoUserJackLord implements AuthenticationDao { private class MockAuthenticationDaoUserJackLord implements UserDetailsService {
private String password = "hawaii50"; private String password = "hawaii50";
public void setPassword(String password) { public void setPassword(String password) {

View File

@ -13,13 +13,14 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao; package org.acegisecurity.userdetails;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.UserDetails; import org.acegisecurity.userdetails.User;
import org.acegisecurity.userdetails.UserDetails;
/** /**

View File

@ -13,13 +13,14 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao.jdbc; package org.acegisecurity.userdetails.jdbc;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.acegisecurity.PopulatedDatabase; import org.acegisecurity.PopulatedDatabase;
import org.acegisecurity.UserDetails; import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.providers.dao.UsernameNotFoundException; import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.acegisecurity.userdetails.jdbc.JdbcDaoImpl;
import org.springframework.jdbc.object.MappingSqlQuery; import org.springframework.jdbc.object.MappingSqlQuery;

View File

@ -13,11 +13,14 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao.memory; package org.acegisecurity.userdetails.memory;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.acegisecurity.providers.dao.UsernameNotFoundException; import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.acegisecurity.userdetails.memory.InMemoryDaoImpl;
import org.acegisecurity.userdetails.memory.UserMap;
import org.acegisecurity.userdetails.memory.UserMapEditor;
import java.util.Properties; import java.util.Properties;

View File

@ -13,7 +13,10 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao.memory; package org.acegisecurity.userdetails.memory;
import org.acegisecurity.userdetails.memory.UserAttribute;
import org.acegisecurity.userdetails.memory.UserAttributeEditor;
import junit.framework.TestCase; import junit.framework.TestCase;

View File

@ -13,7 +13,10 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao.memory; package org.acegisecurity.userdetails.memory;
import org.acegisecurity.userdetails.memory.UserMap;
import org.acegisecurity.userdetails.memory.UserMapEditor;
import junit.framework.TestCase; import junit.framework.TestCase;

View File

@ -13,15 +13,16 @@
* limitations under the License. * limitations under the License.
*/ */
package org.acegisecurity.providers.dao.memory; package org.acegisecurity.userdetails.memory;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.UserDetails; import org.acegisecurity.userdetails.User;
import org.acegisecurity.providers.dao.User; import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.providers.dao.UsernameNotFoundException; import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.acegisecurity.userdetails.memory.UserMap;
/** /**

View File

@ -22,7 +22,7 @@ import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.providers.TestingAuthenticationToken; import org.acegisecurity.providers.TestingAuthenticationToken;
import org.acegisecurity.providers.dao.User; import org.acegisecurity.userdetails.User;
import org.acegisecurity.wrapper.SecurityContextHolderAwareRequestWrapper; import org.acegisecurity.wrapper.SecurityContextHolderAwareRequestWrapper;
import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletRequest;

View File

@ -22,7 +22,7 @@
<beans> <beans>
<!-- Data access object which stores authentication information --> <!-- Data access object which stores authentication information -->
<bean id="inMemoryDaoImpl" class="org.acegisecurity.providers.dao.memory.InMemoryDaoImpl"> <bean id="inMemoryDaoImpl" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
<property name="userMap"> <property name="userMap">
<value> <value>
marissa=koala,ROLE_TELLER,ROLE_SUPERVISOR marissa=koala,ROLE_TELLER,ROLE_SUPERVISOR

View File

@ -22,7 +22,7 @@
<beans> <beans>
<!-- Data access object which stores authentication information --> <!-- Data access object which stores authentication information -->
<bean id="inMemoryDaoImpl" class="org.acegisecurity.providers.dao.memory.InMemoryDaoImpl"> <bean id="inMemoryDaoImpl" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
<property name="userMap"> <property name="userMap">
<value> <value>
marissa=koala,ROLE_TELLER,ROLE_SUPERVISOR marissa=koala,ROLE_TELLER,ROLE_SUPERVISOR

View File

@ -26,7 +26,7 @@
<subtitle>Reference Documentation</subtitle> <subtitle>Reference Documentation</subtitle>
<releaseinfo>1.0.0</releaseinfo> <releaseinfo>1.0.0 RC 1</releaseinfo>
<authorgroup> <authorgroup>
<author> <author>
@ -1405,7 +1405,7 @@ public aspect DomainObjectInstanceSecurityAspect implements InitializingBean {
<para>For a class to be able to provide the <para>For a class to be able to provide the
<literal>DaoAuthenticationProvider</literal> with access to an <literal>DaoAuthenticationProvider</literal> with access to an
authentication repository, it must implement the authentication repository, it must implement the
<literal>AuthenticationDao</literal> interface:</para> <literal>UserDetailsService</literal> interface:</para>
<para><programlisting>public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException;</programlisting></para> <para><programlisting>public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException;</programlisting></para>
@ -1414,8 +1414,9 @@ public aspect DomainObjectInstanceSecurityAspect implements InitializingBean {
information such as the username, password, granted authorities and information such as the username, password, granted authorities and
whether the user is enabled or disabled. A concrete implementation, whether the user is enabled or disabled. A concrete implementation,
<literal>User</literal>, is also provided. Acegi Security users will <literal>User</literal>, is also provided. Acegi Security users will
need to decide when writing their <literal>AuthenticationDao</literal> need to decide when writing their
what type of <literal>UserDetails</literal> to return. In most cases <literal>UserDetailsService</literal> what type of
<literal>UserDetails</literal> to return. In most cases
<literal>User</literal> will be used directly or subclassed, although <literal>User</literal> will be used directly or subclassed, although
special circumstances (such as object relational mappers) may require special circumstances (such as object relational mappers) may require
users to write their own <literal>UserDetails</literal> implementation users to write their own <literal>UserDetails</literal> implementation
@ -1424,13 +1425,13 @@ public aspect DomainObjectInstanceSecurityAspect implements InitializingBean {
number and email address), so they can be easily used by web number and email address), so they can be easily used by web
views.</para> views.</para>
<para>Given <literal>AuthenticationDao</literal> is so simple to <para>Given <literal>UserDetailsService</literal> is so simple to
implement, it should be easy for users to retrieve authentication implement, it should be easy for users to retrieve authentication
information using a persistence strategy of their choice.</para> information using a persistence strategy of their choice.</para>
<para>A design decision was made not to support account locking in the <para>A design decision was made not to support account locking in the
<literal>DaoAuthenticationProvider</literal>, as doing so would have <literal>DaoAuthenticationProvider</literal>, as doing so would have
increased the complexity of the <literal>AuthenticationDao</literal> increased the complexity of the <literal>UserDetailsService</literal>
interface. For instance, a method would be required to increase the interface. For instance, a method would be required to increase the
count of unsuccessful authentication attempts. Such functionality count of unsuccessful authentication attempts. Such functionality
could be easily provided by leveraging the application event could be easily provided by leveraging the application event
@ -1441,7 +1442,7 @@ public aspect DomainObjectInstanceSecurityAspect implements InitializingBean {
<literal>principal</literal> property set. The principal will be <literal>principal</literal> property set. The principal will be
either a <literal>String</literal> (which is essentially the username) either a <literal>String</literal> (which is essentially the username)
or a <literal>UserDetails</literal> object (which was looked up from or a <literal>UserDetails</literal> object (which was looked up from
the <literal>AuthenticationDao</literal>). By default the the <literal>UserDetailsService</literal>). By default the
<literal>UserDetails</literal> is returned, as this enables <literal>UserDetails</literal> is returned, as this enables
applications to add extra properties potentially of use in applications to add extra properties potentially of use in
applications, such as the user's full name, email address etc. If applications, such as the user's full name, email address etc. If
@ -1458,7 +1459,7 @@ public aspect DomainObjectInstanceSecurityAspect implements InitializingBean {
<para>Whilst it is easy to use the <para>Whilst it is easy to use the
<literal>DaoAuthenticationProvider</literal> and create a custom <literal>DaoAuthenticationProvider</literal> and create a custom
<literal>AuthenticationDao</literal> implementation that extracts <literal>UserDetailsService</literal> implementation that extracts
information from a persistence engine of choice, many applications do information from a persistence engine of choice, many applications do
not require such complexity. One alternative is to configure an not require such complexity. One alternative is to configure an
authentication repository in the application context itself using the authentication repository in the application context itself using the
@ -1769,7 +1770,7 @@ public aspect DomainObjectInstanceSecurityAspect implements InitializingBean {
system (<literal>Authentication</literal>, system (<literal>Authentication</literal>,
<literal>AuthenticationManager</literal>, <literal>AuthenticationManager</literal>,
<literal>AuthenticationProvider</literal> and <literal>AuthenticationProvider</literal> and
<literal>AuthenticationDao</literal>) it might be confusing to a new <literal>UserDetailsService</literal>) it might be confusing to a new
user to know which part of the authentication system to customize. In user to know which part of the authentication system to customize. In
general, the following is recommended:</para> general, the following is recommended:</para>
@ -1785,8 +1786,8 @@ public aspect DomainObjectInstanceSecurityAspect implements InitializingBean {
repository (eg to obtain user details from your applications repository (eg to obtain user details from your applications
existing database), use the existing database), use the
<literal>DaoAuthenticationProvider</literal> along with the <literal>DaoAuthenticationProvider</literal> along with the
<literal>AuthenticationDao</literal>. It is the fastest and safest <literal>UserDetailsService</literal>. It is the fastest and
way to integrate an external database.</para> safest way to integrate an external database.</para>
</listitem> </listitem>
<listitem> <listitem>
@ -2732,7 +2733,7 @@ key: A private key to prevent modification of the nonce token
&lt;property name="nonceValiditySeconds"&gt;&lt;value&gt;10&lt;/value&gt;&lt;/property&gt; &lt;property name="nonceValiditySeconds"&gt;&lt;value&gt;10&lt;/value&gt;&lt;/property&gt;
&lt;/bean&gt;</programlisting></para> &lt;/bean&gt;</programlisting></para>
<para>The configured <literal>AuthenticationDao</literal> is needed <para>The configured <literal>UserDetailsService</literal> is needed
because <literal>DigestProcessingFilter</literal> must have direct because <literal>DigestProcessingFilter</literal> must have direct
access to the clear text password of a user. Digest Authentication access to the clear text password of a user. Digest Authentication
will NOT work if you are using encoded passwords in your DAO. The DAO will NOT work if you are using encoded passwords in your DAO. The DAO
@ -2928,10 +2929,10 @@ key: A private key to prevent modification of the remember-me token
by <literal>RememberMeAuthenticationProvider</literal>. A by <literal>RememberMeAuthenticationProvider</literal>. A
<literal>key</literal> is shared between this authentication provider <literal>key</literal> is shared between this authentication provider
and the <literal>TokenBasedRememberMeServices</literal>. In addition, and the <literal>TokenBasedRememberMeServices</literal>. In addition,
<literal>TokenBasedRememberMeServices</literal> requires an <literal>TokenBasedRememberMeServices</literal> requires A
<literal>AuthenticationDao</literal> from which it can retrieve the UserDetailsService from which it can retrieve the username and
username and password for signature comparison purposes, and generate password for signature comparison purposes, and generate the
the <literal>RememberMeAuthenticationToken</literal> to contain the <literal>RememberMeAuthenticationToken</literal> to contain the
correct <literal>GrantedAuthority</literal>[]s. Some sort of logout correct <literal>GrantedAuthority</literal>[]s. Some sort of logout
command should be provided by the application (typically via a JSP) command should be provided by the application (typically via a JSP)
that invalidates the cookie upon user request. See the Contacts Sample that invalidates the cookie upon user request. See the Contacts Sample
@ -3634,12 +3635,12 @@ $CATALINA_HOME/bin/startup.sh</programlisting></para>
<literal>GrantedAuthority</literal> objects that apply to the user <literal>GrantedAuthority</literal> objects that apply to the user
contained in the <literal>TicketResponse</literal>. Acegi Security contained in the <literal>TicketResponse</literal>. Acegi Security
includes a <literal>DaoCasAuthoritiesPopulator</literal> which includes a <literal>DaoCasAuthoritiesPopulator</literal> which
simply uses the <literal>AuthenticationDao</literal> simply uses the <literal>UserDetailsService</literal>
infrastructure to find the <literal>UserDetails</literal> and infrastructure to find the <literal>UserDetails</literal> and
their associated <literal>GrantedAuthority</literal>s. Note that their associated <literal>GrantedAuthority</literal>s. Note that
the password and enabled/disabled status of the password and enabled/disabled status of
<literal>UserDetails</literal> returned by the <literal>UserDetails</literal> returned by the
<literal>AuthenticationDao</literal> are ignored, as the CAS <literal>UserDetailsService</literal> are ignored, as the CAS
server is responsible for authentication decisions. server is responsible for authentication decisions.
<literal>DaoCasAuthoritiesPopulator</literal> is only concerned <literal>DaoCasAuthoritiesPopulator</literal> is only concerned
with retrieving the <literal>GrantedAuthority</literal>s.</para> with retrieving the <literal>GrantedAuthority</literal>s.</para>
@ -4086,9 +4087,8 @@ $CATALINA_HOME/bin/startup.sh</programlisting></para>
which extracts the user's name from the subject <quote>common which extracts the user's name from the subject <quote>common
name</quote> (CN) in the certificate. It also allows you to set name</quote> (CN) in the certificate. It also allows you to set
your own regular expression to match a different part of the your own regular expression to match a different part of the
subject's distinguished name. An subject's distinguished name. A UserDetailsService is used to
<classname>AuthenticationDao</classname> is used to load the load the user information.<!-- TODO: Give email matching as an example --></para>
user information.<!-- TODO: Give email matching as an example --></para>
</listitem> </listitem>

View File

@ -17,7 +17,8 @@ applications:
<li>net.sf.acegisecurity.providers.dao.AuthenticationDao is now org.acegisecurity.userdetails.UserDetailsService. <li>net.sf.acegisecurity.providers.dao.AuthenticationDao is now org.acegisecurity.userdetails.UserDetailsService.
The interface signature has not changed. Similarly, User and UserDetails have moved into the latter's package as well. The interface signature has not changed. Similarly, User and UserDetails have moved into the latter's package as well.
If you've implemented your own AuthenticationDao, you'll need to change the class it's implementing and quite likely If you've implemented your own AuthenticationDao, you'll need to change the class it's implementing and quite likely
the import packages for User and UserDetails.</li> the import packages for User and UserDetails. In addition, if using JdbcDaoImpl or InMemoryDaoImpl please
note they have moved to this new package.</li>
<li>Acegi Security is now localised. In net.sf.acegisecurity you will find a messages.properties. It is <li>Acegi Security is now localised. In net.sf.acegisecurity you will find a messages.properties. It is
suggested to register this in your application context, perhaps using ReloadableResourceBundleMessageSource. suggested to register this in your application context, perhaps using ReloadableResourceBundleMessageSource.

View File

@ -5,12 +5,12 @@ import java.io.IOException;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.acegisecurity.UserDetails;
import org.acegisecurity.intercept.web.FilterSecurityInterceptor; import org.acegisecurity.intercept.web.FilterSecurityInterceptor;
import org.acegisecurity.intercept.web.SecurityEnforcementFilter; import org.acegisecurity.intercept.web.SecurityEnforcementFilter;
import org.acegisecurity.providers.ProviderManager; import org.acegisecurity.providers.ProviderManager;
import org.acegisecurity.providers.dao.DaoAuthenticationProvider; import org.acegisecurity.providers.dao.DaoAuthenticationProvider;
import org.acegisecurity.providers.dao.memory.InMemoryDaoImpl; import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.memory.InMemoryDaoImpl;
import org.acegisecurity.util.InMemoryResource; import org.acegisecurity.util.InMemoryResource;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.io.OutputFormat; import org.dom4j.io.OutputFormat;

View File

@ -19,13 +19,13 @@ import java.util.List;
import java.util.Random; import java.util.Random;
import org.acegisecurity.Authentication; import org.acegisecurity.Authentication;
import org.acegisecurity.UserDetails;
import org.acegisecurity.acl.basic.AclObjectIdentity; import org.acegisecurity.acl.basic.AclObjectIdentity;
import org.acegisecurity.acl.basic.BasicAclExtendedDao; import org.acegisecurity.acl.basic.BasicAclExtendedDao;
import org.acegisecurity.acl.basic.NamedEntityObjectIdentity; import org.acegisecurity.acl.basic.NamedEntityObjectIdentity;
import org.acegisecurity.acl.basic.SimpleAclEntry; import org.acegisecurity.acl.basic.SimpleAclEntry;
import org.acegisecurity.annotation.Secured; import org.acegisecurity.annotation.Secured;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.userdetails.UserDetails;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.support.ApplicationObjectSupport; import org.springframework.context.support.ApplicationObjectSupport;

View File

@ -16,12 +16,12 @@
package sample.contact; package sample.contact;
import org.acegisecurity.Authentication; import org.acegisecurity.Authentication;
import org.acegisecurity.UserDetails;
import org.acegisecurity.acl.basic.AclObjectIdentity; import org.acegisecurity.acl.basic.AclObjectIdentity;
import org.acegisecurity.acl.basic.BasicAclExtendedDao; import org.acegisecurity.acl.basic.BasicAclExtendedDao;
import org.acegisecurity.acl.basic.NamedEntityObjectIdentity; import org.acegisecurity.acl.basic.NamedEntityObjectIdentity;
import org.acegisecurity.acl.basic.SimpleAclEntry; import org.acegisecurity.acl.basic.SimpleAclEntry;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.userdetails.UserDetails;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;

View File

@ -14,8 +14,8 @@ import javax.naming.directory.InitialDirContext;
import org.acegisecurity.BadCredentialsException; import org.acegisecurity.BadCredentialsException;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.UserDetails; import org.acegisecurity.userdetails.User;
import org.acegisecurity.providers.dao.User; import org.acegisecurity.userdetails.UserDetails;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;

View File

@ -16,7 +16,7 @@
package org.acegisecurity.providers.dao.ldap; package org.acegisecurity.providers.dao.ldap;
import org.acegisecurity.BadCredentialsException; import org.acegisecurity.BadCredentialsException;
import org.acegisecurity.UserDetails; import org.acegisecurity.userdetails.UserDetails;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;

View File

@ -22,12 +22,12 @@ import org.acegisecurity.AuthenticationServiceException;
import org.acegisecurity.CredentialsExpiredException; import org.acegisecurity.CredentialsExpiredException;
import org.acegisecurity.DisabledException; import org.acegisecurity.DisabledException;
import org.acegisecurity.LockedException; import org.acegisecurity.LockedException;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.AuthenticationProvider; import org.acegisecurity.providers.AuthenticationProvider;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.providers.dao.DaoAuthenticationProvider; import org.acegisecurity.providers.dao.DaoAuthenticationProvider;
import org.acegisecurity.providers.dao.UserCache; import org.acegisecurity.providers.dao.UserCache;
import org.acegisecurity.providers.dao.cache.NullUserCache; import org.acegisecurity.providers.dao.cache.NullUserCache;
import org.acegisecurity.userdetails.UserDetails;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;

View File

@ -18,9 +18,9 @@ import javax.naming.directory.SearchResult;
import org.acegisecurity.BadCredentialsException; import org.acegisecurity.BadCredentialsException;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.User;
import org.acegisecurity.providers.dao.ldap.PasswordAuthenticationDao; import org.acegisecurity.providers.dao.ldap.PasswordAuthenticationDao;
import org.acegisecurity.userdetails.User;
import org.acegisecurity.userdetails.UserDetails;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;

View File

@ -34,9 +34,9 @@ import org.acegisecurity.Authentication;
import org.acegisecurity.AuthenticationTrustResolver; import org.acegisecurity.AuthenticationTrustResolver;
import org.acegisecurity.AuthenticationTrustResolverImpl; import org.acegisecurity.AuthenticationTrustResolverImpl;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.UserDetails;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.intercept.web.SandboxSecurityEnforcementFilter; import org.acegisecurity.intercept.web.SandboxSecurityEnforcementFilter;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.wrapper.redirect.Enumerator; import org.acegisecurity.wrapper.redirect.Enumerator;
import org.acegisecurity.wrapper.redirect.FastHttpDateFormat; import org.acegisecurity.wrapper.redirect.FastHttpDateFormat;
import org.acegisecurity.wrapper.redirect.SavedHttpServletRequest; import org.acegisecurity.wrapper.redirect.SavedHttpServletRequest;

View File

@ -16,8 +16,8 @@
package org.acegisecurity.providers.dao.ldap; package org.acegisecurity.providers.dao.ldap;
import org.acegisecurity.BadCredentialsException; import org.acegisecurity.BadCredentialsException;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.dao.ldap.support.BaseLdapTestCase; import org.acegisecurity.providers.dao.ldap.support.BaseLdapTestCase;
import org.acegisecurity.userdetails.UserDetails;
import javax.naming.NamingException; import javax.naming.NamingException;

View File

@ -28,14 +28,14 @@ import org.acegisecurity.DisabledException;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl; import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.LockedException; import org.acegisecurity.LockedException;
import org.acegisecurity.UserDetails;
import org.acegisecurity.providers.TestingAuthenticationToken; import org.acegisecurity.providers.TestingAuthenticationToken;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.providers.dao.User;
import org.acegisecurity.providers.dao.UserCache; import org.acegisecurity.providers.dao.UserCache;
import org.acegisecurity.providers.dao.UsernameNotFoundException;
import org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache; import org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache;
import org.acegisecurity.providers.dao.cache.NullUserCache; import org.acegisecurity.providers.dao.cache.NullUserCache;
import org.acegisecurity.userdetails.User;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.dao.DataRetrievalFailureException; import org.springframework.dao.DataRetrievalFailureException;