|
|||||||||
| Home >> All >> net >> sf >> acegisecurity >> providers >> [ dao overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
net.sf.acegisecurity.providers.dao
Class PasswordDaoAuthenticationProvider

java.lang.Objectnet.sf.acegisecurity.providers.dao.PasswordDaoAuthenticationProvider
- All Implemented Interfaces:
- org.springframework.context.ApplicationContextAware, net.sf.acegisecurity.providers.AuthenticationProvider, org.springframework.beans.factory.InitializingBean
- public class PasswordDaoAuthenticationProvider
- extends java.lang.Object
- implements net.sf.acegisecurity.providers.AuthenticationProvider, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware
- extends java.lang.Object
An net.sf.acegisecurity.providers.AuthenticationProvider implementation that retrieves user details from a PasswordAuthenticationDao.
This AuthenticationProvider is capable of validating net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken requests containing the correct
username, password and when the user is not disabled.
Unlike DaoAuthenticationProvider, the responsibility for password
validation is delegated to PasswordAuthenticationDao.
Upon successful validation, a
UsernamePasswordAuthenticationToken will be created and
returned to the caller. The token will include as its principal either a
String representation of the username, or the net.sf.acegisecurity.UserDetails that was returned from the authentication repository. Using
String is appropriate if a container adapter is being used, as
it expects String representations of the username. Using
UserDetails is appropriate if you require access to additional
properties of the authenticated user, such as email addresses,
human-friendly names etc. As container adapters are not recommended to be
used, and UserDetails implementations provide additional
flexibility, by default a UserDetails is returned. To override
this default, set the setForcePrincipalAsString(boolean) 55 to
true.
Caching is handled via the UserDetails object being placed in
the UserCache. This ensures that subsequent requests with the same
username and password can be validated without needing to query the PasswordAuthenticationDao. It should be noted that if a user appears to
present an incorrect password, the PasswordAuthenticationDao will
be queried to confirm the most up-to-date password was used for comparison.
If an application context is detected (which is automatically the case when the bean is started within a Spring container), application events will be published to the context. See net.sf.acegisecurity.providers.dao.event.AuthenticationEvent for further information.
| Field Summary | |
private PasswordAuthenticationDao |
authenticationDao
|
private org.springframework.context.ApplicationContext |
context
|
private boolean |
forcePrincipalAsString
|
private UserCache |
userCache
|
| Constructor Summary | |
PasswordDaoAuthenticationProvider()
|
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
context
private org.springframework.context.ApplicationContext context
authenticationDao
private PasswordAuthenticationDao authenticationDao
userCache
private UserCache userCache
forcePrincipalAsString
private boolean forcePrincipalAsString
| Constructor Detail |
PasswordDaoAuthenticationProvider
public PasswordDaoAuthenticationProvider()
| Method Detail |
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
- Description copied from interface:
org.springframework.context.ApplicationContextAware - Set the ApplicationContext that this object runs in.
Normally this call will be used to initialize the object.
Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked after ResourceLoaderAware's setResourceLoader.
- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
getContext
public org.springframework.context.ApplicationContext getContext()
setForcePrincipalAsString
public void setForcePrincipalAsString(boolean forcePrincipalAsString)
isForcePrincipalAsString
public boolean isForcePrincipalAsString()
setPasswordAuthenticationDao
public void setPasswordAuthenticationDao(PasswordAuthenticationDao authenticationDao)
getPasswordAuthenticationDao
public PasswordAuthenticationDao getPasswordAuthenticationDao()
setUserCache
public void setUserCache(UserCache userCache)
getUserCache
public UserCache getUserCache()
afterPropertiesSet
public void afterPropertiesSet()
throws java.lang.Exception
- Description copied from interface:
org.springframework.beans.factory.InitializingBean - Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
authenticate
public net.sf.acegisecurity.Authentication authenticate(net.sf.acegisecurity.Authentication authentication) throws net.sf.acegisecurity.AuthenticationException
- Description copied from interface:
net.sf.acegisecurity.providers.AuthenticationProvider - Performs authentication with the same contract as AuthenticationManager.authenticate(Authentication)>
AuthenticationManager.authenticate(Authentication)55 .- Specified by:
authenticatein interfacenet.sf.acegisecurity.providers.AuthenticationProvider
supports
public boolean supports(java.lang.Class authentication)
- Description copied from interface:
net.sf.acegisecurity.providers.AuthenticationProvider - Returns
trueif thisAuthenticationProvidersupports the indicatedAuthenticationobject.Returning
truedoes not guarantee anAuthenticationProviderwill be able to authenticate the presented instance of theAuthenticationclass. It simply indicates it can support closer evaluation of it. AnAuthenticationProvidercan still returnnullfrom the AuthenticationProvider.authenticate(Authentication)>AuthenticationProvider.authenticate(Authentication)55 method to indicate anotherAuthenticationProvidershould be tried.Selection of an
AuthenticationProvidercapable of performing authentication is conducted at runtime theProviderManager.- Specified by:
supportsin interfacenet.sf.acegisecurity.providers.AuthenticationProvider
createSuccessAuthentication
protected net.sf.acegisecurity.Authentication createSuccessAuthentication(java.lang.Object principal, net.sf.acegisecurity.Authentication authentication, net.sf.acegisecurity.UserDetails user)
- Creates a successful net.sf.acegisecurity.Authentication object.
Protected so subclasses can override. This might be required if multiple credentials need to be placed into a custom
Authenticationobject, such as a password as well as a ZIP code.Subclasses will usually store the original credentials the user supplied (not salted or encoded passwords) in the returned
Authenticationobject.
getUserFromBackend
private net.sf.acegisecurity.UserDetails getUserFromBackend(java.lang.String username, java.lang.String password)
|
|||||||||
| Home >> All >> net >> sf >> acegisecurity >> providers >> [ dao overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
net.sf.acegisecurity.providers.dao.PasswordDaoAuthenticationProvider