Class RepositoryAuthenticationDao
java.lang.Object
org.alfresco.repo.security.authentication.RepositoryAuthenticationDao
- All Implemented Interfaces:
net.sf.acegisecurity.providers.dao.AuthenticationDao,net.sf.acegisecurity.providers.dao.SaltSource,NodeServicePolicies.BeforeDeleteNodePolicy,NodeServicePolicies.OnUpdatePropertiesPolicy,ClassPolicy,Policy,MutableAuthenticationDao,org.springframework.beans.factory.InitializingBean
public class RepositoryAuthenticationDao
extends Object
implements MutableAuthenticationDao, org.springframework.beans.factory.InitializingBean, NodeServicePolicies.OnUpdatePropertiesPolicy, NodeServicePolicies.BeforeDeleteNodePolicy
Component to provide authentication using native Alfresco authentication
- Since:
- 1.2
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy
Policy.Arg -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuthorityServiceprotected CompositePasswordEncoderprotected NamespacePrefixResolverprotected NodeServiceprotected PolicyComponentprotected TenantServiceFields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
QNAMEFields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy
ARG_0, ARG_1, ARG_2, QNAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidbeforeDeleteNode(NodeRef nodeRef) Called before a node is deleted.voidcreateUser(String caseSensitiveUserName, char[] rawPassword) Create a user with the given userName and passwordvoidcreateUser(String caseSensitiveUserName, String hashedPassword, char[] rawPassword) Create a user with the given userName and password hash If hashedPassword is passed in then this is used, otherwise it falls back to using the rawPassword.voiddeleteUser(String userName) Delete a user.determinePasswordHash(Map<QName, Serializable> properties) Retrieves the password hash for the given user properties.booleangetAccountExpires(String userName) Does the account expire?getAccountExpiryDate(String userName) Get the date when this account expires.booleangetAccountHasExpired(String userName) Has the account expired?booleangetAccountlocked(String userName) Is the account locked?booleangetCredentialsExpire(String userName) Do the credentials for the user expire?protected booleangetCredentialsExpire(String userName, Map<QName, Serializable> properties) getCredentialsExpiryDate(String userName) Get the date when the credentials/password expire.booleangetCredentialsHaveExpired(String userName) Have the credentials for the user expired?protected booleangetCredentialsHaveExpired(String userName, Map<QName, Serializable> properties, Boolean isAdminAuthority) booleangetEnabled(String userName) Getter for user enabledprotected booleangetEnabled(String userName, Map<QName, Serializable> properties, Boolean isAdminAuthority) protected booleangetHasExpired(String userName, Map<QName, Serializable> properties, Boolean isAdminAuthority) booleanCheck if the account is lockedprotected booleangetMD4HashedPassword(String userName) Get the MD4 password hashgetSalt(net.sf.acegisecurity.UserDetails userDetails) getUserOrNull(String caseSensitiveSearchUserName) protected Map<QName,Serializable> getUserProperties(String userName) net.sf.acegisecurity.UserDetailsloadUserByUsername(String incomingUserName) voidonUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) Called after a node's properties have been changed.voidonUpdateUserProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) voidsetAccountExpires(String userName, boolean expires) Set if the account should expirevoidsetAccountExpiryDate(String userName, Date expiryDate) Set the date on which the account expiresvoidsetAuthenticationCache(SimpleCache<String, org.alfresco.repo.security.authentication.RepositoryAuthenticationDao.CacheEntry> authenticationCache) voidsetAuthorityService(AuthorityService authorityService) voidsetCompositePasswordEncoder(CompositePasswordEncoder compositePasswordEncoder) voidsetCredentialsExpire(String userName, boolean expires) Set if the password expires.voidsetCredentialsExpiryDate(String userName, Date exipryDate) Set the date when credentials expire.voidsetEnabled(String userName, boolean enabled) Enable/disable a user.voidSet if the account is locked.voidsetNamespaceService(NamespacePrefixResolver namespacePrefixResolver) voidsetNodeService(NodeService nodeService) voidsetPolicyComponent(PolicyComponent policyComponent) voidsetSingletonCache(SimpleCache<String, NodeRef> singletonCache) voidsetTenantService(TenantService tenantService) voidsetTransactionService(TransactionService transactionService) voidupdateUser(String userName, char[] rawPassword) Update a user's password.booleanuserExists(String userName) Check is a user exists.
-
Field Details
-
authorityService
-
nodeService
-
tenantService
-
namespacePrefixResolver
-
policyComponent
-
compositePasswordEncoder
-
-
Constructor Details
-
RepositoryAuthenticationDao
public RepositoryAuthenticationDao()
-
-
Method Details
-
setNamespaceService
-
setAuthorityService
-
setNodeService
-
setTenantService
-
setSingletonCache
-
setPolicyComponent
-
setAuthenticationCache
public void setAuthenticationCache(SimpleCache<String, org.alfresco.repo.security.authentication.RepositoryAuthenticationDao.CacheEntry> authenticationCache) -
setTransactionService
-
setCompositePasswordEncoder
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
loadUserByUsername
public net.sf.acegisecurity.UserDetails loadUserByUsername(String incomingUserName) throws net.sf.acegisecurity.providers.dao.UsernameNotFoundException, org.springframework.dao.DataAccessException - Specified by:
loadUserByUsernamein interfacenet.sf.acegisecurity.providers.dao.AuthenticationDao- Throws:
net.sf.acegisecurity.providers.dao.UsernameNotFoundExceptionorg.springframework.dao.DataAccessException
-
getUserOrNull
- Parameters:
caseSensitiveSearchUserName- case sensitive user name- Returns:
- the user's authentication node ref or null
-
determinePasswordHash
Retrieves the password hash for the given user properties.- Parameters:
properties- The properties of the user.- Returns:
- A Pair object containing the hash indicator and the hashed password.
-
createUser
public void createUser(String caseSensitiveUserName, char[] rawPassword) throws AuthenticationException Description copied from interface:MutableAuthenticationDaoCreate a user with the given userName and password- Specified by:
createUserin interfaceMutableAuthenticationDao- Throws:
AuthenticationException
-
createUser
public void createUser(String caseSensitiveUserName, String hashedPassword, char[] rawPassword) throws AuthenticationException Description copied from interface:MutableAuthenticationDaoCreate a user with the given userName and password hash If hashedPassword is passed in then this is used, otherwise it falls back to using the rawPassword. It is assumed the hashed password has been encoded using system.preferred.password.encoding and doesn't use its own salt.- Specified by:
createUserin interfaceMutableAuthenticationDao- Throws:
AuthenticationException
-
updateUser
Description copied from interface:MutableAuthenticationDaoUpdate a user's password.- Specified by:
updateUserin interfaceMutableAuthenticationDao- Throws:
AuthenticationException
-
deleteUser
Description copied from interface:MutableAuthenticationDaoDelete a user.- Specified by:
deleteUserin interfaceMutableAuthenticationDao- Throws:
AuthenticationException
-
getSalt
- Specified by:
getSaltin interfacenet.sf.acegisecurity.providers.dao.SaltSource
-
userExists
Description copied from interface:MutableAuthenticationDaoCheck is a user exists.- Specified by:
userExistsin interfaceMutableAuthenticationDao
-
getUserProperties
- Returns:
- Returns the user properties or null if there are none
-
getAccountExpires
Description copied from interface:MutableAuthenticationDaoDoes the account expire?- Specified by:
getAccountExpiresin interfaceMutableAuthenticationDao
-
getAccountExpiryDate
Description copied from interface:MutableAuthenticationDaoGet the date when this account expires.- Specified by:
getAccountExpiryDatein interfaceMutableAuthenticationDao
-
getAccountHasExpired
Description copied from interface:MutableAuthenticationDaoHas the account expired?- Specified by:
getAccountHasExpiredin interfaceMutableAuthenticationDao
-
getHasExpired
protected boolean getHasExpired(String userName, Map<QName, Serializable> properties, Boolean isAdminAuthority) - Parameters:
userName- the usernameproperties- user properties or null to fetch them
-
getLocked
Description copied from interface:MutableAuthenticationDaoCheck if the account is locked- Specified by:
getLockedin interfaceMutableAuthenticationDao- Parameters:
userName- the username
-
getAccountlocked
Description copied from interface:MutableAuthenticationDaoIs the account locked?- Specified by:
getAccountlockedin interfaceMutableAuthenticationDao
-
getLocked
protected boolean getLocked(String userName, Map<QName, Serializable> properties, Boolean isAdminAuthority) - Parameters:
userName- the usernameproperties- user properties or null to fetch them
-
getCredentialsExpire
Description copied from interface:MutableAuthenticationDaoDo the credentials for the user expire?- Specified by:
getCredentialsExpirein interfaceMutableAuthenticationDao
-
getCredentialsExpire
- Parameters:
userName- the usernameproperties- user properties or null to fetch them
-
getCredentialsExpiryDate
Description copied from interface:MutableAuthenticationDaoGet the date when the credentials/password expire.- Specified by:
getCredentialsExpiryDatein interfaceMutableAuthenticationDao
-
getCredentialsHaveExpired
Description copied from interface:MutableAuthenticationDaoHave the credentials for the user expired?- Specified by:
getCredentialsHaveExpiredin interfaceMutableAuthenticationDao
-
getCredentialsHaveExpired
protected boolean getCredentialsHaveExpired(String userName, Map<QName, Serializable> properties, Boolean isAdminAuthority) - Parameters:
userName- the username (never nullproperties- the properties associated with the user or null to get themisAdminAuthority- is admin authority- Returns:
- true if the user account has expired
-
getEnabled
Description copied from interface:MutableAuthenticationDaoGetter for user enabled- Specified by:
getEnabledin interfaceMutableAuthenticationDao
-
getEnabled
protected boolean getEnabled(String userName, Map<QName, Serializable> properties, Boolean isAdminAuthority) - Parameters:
userName- the usernameproperties- the user's properties or null
-
setAccountExpires
Description copied from interface:MutableAuthenticationDaoSet if the account should expire- Specified by:
setAccountExpiresin interfaceMutableAuthenticationDao
-
setAccountExpiryDate
Description copied from interface:MutableAuthenticationDaoSet the date on which the account expires- Specified by:
setAccountExpiryDatein interfaceMutableAuthenticationDao
-
setCredentialsExpire
Description copied from interface:MutableAuthenticationDaoSet if the password expires.- Specified by:
setCredentialsExpirein interfaceMutableAuthenticationDao
-
setCredentialsExpiryDate
Description copied from interface:MutableAuthenticationDaoSet the date when credentials expire.- Specified by:
setCredentialsExpiryDatein interfaceMutableAuthenticationDao
-
setEnabled
Description copied from interface:MutableAuthenticationDaoEnable/disable a user.- Specified by:
setEnabledin interfaceMutableAuthenticationDao
-
setLocked
Description copied from interface:MutableAuthenticationDaoSet if the account is locked.- Specified by:
setLockedin interfaceMutableAuthenticationDao
-
getMD4HashedPassword
Description copied from interface:MutableAuthenticationDaoGet the MD4 password hash- Specified by:
getMD4HashedPasswordin interfaceMutableAuthenticationDao
-
onUpdateProperties
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) Description copied from interface:NodeServicePolicies.OnUpdatePropertiesPolicyCalled after a node's properties have been changed.- Specified by:
onUpdatePropertiesin interfaceNodeServicePolicies.OnUpdatePropertiesPolicy- Parameters:
nodeRef- reference to the updated nodebefore- the node's properties before the changeafter- the node's properties after the change
-
onUpdateUserProperties
public void onUpdateUserProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) -
beforeDeleteNode
Description copied from interface:NodeServicePolicies.BeforeDeleteNodePolicyCalled before a node is deleted.- Specified by:
beforeDeleteNodein interfaceNodeServicePolicies.BeforeDeleteNodePolicy- Parameters:
nodeRef- the node reference
-