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 java.lang.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
Fields Modifier and Type Field Description protected AuthorityServiceauthorityServiceprotected CompositePasswordEncodercompositePasswordEncoderprotected org.alfresco.service.namespace.NamespacePrefixResolvernamespacePrefixResolverprotected org.alfresco.service.cmr.repository.NodeServicenodeServiceprotected PolicyComponentpolicyComponentprotected org.alfresco.repo.tenant.TenantServicetenantService-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
QNAME
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy
ARG_0, ARG_1, ARG_2, QNAME
-
-
Constructor Summary
Constructors Constructor Description RepositoryAuthenticationDao()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()voidbeforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)Called before a node is deleted.voidcreateUser(java.lang.String caseSensitiveUserName, char[] rawPassword)Create a user with the given userName and passwordvoidcreateUser(java.lang.String caseSensitiveUserName, java.lang.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(java.lang.String userName)Delete a user.static org.alfresco.util.Pair<java.util.List<java.lang.String>,java.lang.String>determinePasswordHash(java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties)Retrieves the password hash for the given user properties.booleangetAccountExpires(java.lang.String userName)Does the account expire?java.util.DategetAccountExpiryDate(java.lang.String userName)Get the date when this account expires.booleangetAccountHasExpired(java.lang.String userName)Has the account expired?booleangetAccountlocked(java.lang.String userName)Is the account locked?booleangetCredentialsExpire(java.lang.String userName)Do the credentials for the user expire?protected booleangetCredentialsExpire(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties)java.util.DategetCredentialsExpiryDate(java.lang.String userName)Get the date when the credentials/password expire.booleangetCredentialsHaveExpired(java.lang.String userName)Have the credentials for the user expired?protected booleangetCredentialsHaveExpired(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties, java.lang.Boolean isAdminAuthority)booleangetEnabled(java.lang.String userName)Getter for user enabledprotected booleangetEnabled(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties, java.lang.Boolean isAdminAuthority)protected booleangetHasExpired(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties, java.lang.Boolean isAdminAuthority)booleangetLocked(java.lang.String userName)Check if the account is lockedprotected booleangetLocked(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties, java.lang.Boolean isAdminAuthority)java.lang.StringgetMD4HashedPassword(java.lang.String userName)Get the MD4 password hashjava.lang.ObjectgetSalt(net.sf.acegisecurity.UserDetails userDetails)org.alfresco.service.cmr.repository.NodeRefgetUserOrNull(java.lang.String caseSensitiveSearchUserName)protected java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable>getUserProperties(java.lang.String userName)net.sf.acegisecurity.UserDetailsloadUserByUsername(java.lang.String incomingUserName)voidonUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> before, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> after)Called after a node's properties have been changed.voidonUpdateUserProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> before, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> after)voidsetAccountExpires(java.lang.String userName, boolean expires)Set if the account should expirevoidsetAccountExpiryDate(java.lang.String userName, java.util.Date expiryDate)Set the date on which the account expiresvoidsetAuthenticationCache(org.alfresco.repo.cache.SimpleCache<java.lang.String,org.alfresco.repo.security.authentication.RepositoryAuthenticationDao.CacheEntry> authenticationCache)voidsetAuthorityService(AuthorityService authorityService)voidsetCompositePasswordEncoder(CompositePasswordEncoder compositePasswordEncoder)voidsetCredentialsExpire(java.lang.String userName, boolean expires)Set if the password expires.voidsetCredentialsExpiryDate(java.lang.String userName, java.util.Date exipryDate)Set the date when credentials expire.voidsetEnabled(java.lang.String userName, boolean enabled)Enable/disable a user.voidsetLocked(java.lang.String userName, boolean locked)Set if the account is locked.voidsetNamespaceService(org.alfresco.service.namespace.NamespacePrefixResolver namespacePrefixResolver)voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)voidsetPolicyComponent(PolicyComponent policyComponent)voidsetSingletonCache(org.alfresco.repo.cache.SimpleCache<java.lang.String,org.alfresco.service.cmr.repository.NodeRef> singletonCache)voidsetTenantService(org.alfresco.repo.tenant.TenantService tenantService)voidsetTransactionService(TransactionService transactionService)voidupdateUser(java.lang.String userName, char[] rawPassword)Update a user's password.booleanuserExists(java.lang.String userName)Check is a user exists.
-
-
-
Field Detail
-
authorityService
protected AuthorityService authorityService
-
nodeService
protected org.alfresco.service.cmr.repository.NodeService nodeService
-
tenantService
protected org.alfresco.repo.tenant.TenantService tenantService
-
namespacePrefixResolver
protected org.alfresco.service.namespace.NamespacePrefixResolver namespacePrefixResolver
-
policyComponent
protected PolicyComponent policyComponent
-
compositePasswordEncoder
protected CompositePasswordEncoder compositePasswordEncoder
-
-
Method Detail
-
setNamespaceService
public void setNamespaceService(org.alfresco.service.namespace.NamespacePrefixResolver namespacePrefixResolver)
-
setAuthorityService
public void setAuthorityService(AuthorityService authorityService)
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
-
setTenantService
public void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
-
setSingletonCache
public void setSingletonCache(org.alfresco.repo.cache.SimpleCache<java.lang.String,org.alfresco.service.cmr.repository.NodeRef> singletonCache)
-
setPolicyComponent
public void setPolicyComponent(PolicyComponent policyComponent)
-
setAuthenticationCache
public void setAuthenticationCache(org.alfresco.repo.cache.SimpleCache<java.lang.String,org.alfresco.repo.security.authentication.RepositoryAuthenticationDao.CacheEntry> authenticationCache)
-
setTransactionService
public void setTransactionService(TransactionService transactionService)
-
setCompositePasswordEncoder
public void setCompositePasswordEncoder(CompositePasswordEncoder compositePasswordEncoder)
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
java.lang.Exception
-
loadUserByUsername
public net.sf.acegisecurity.UserDetails loadUserByUsername(java.lang.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
public org.alfresco.service.cmr.repository.NodeRef getUserOrNull(java.lang.String caseSensitiveSearchUserName)
- Parameters:
caseSensitiveSearchUserName- case sensitive user name- Returns:
- the user's authentication node ref or null
-
determinePasswordHash
public static org.alfresco.util.Pair<java.util.List<java.lang.String>,java.lang.String> determinePasswordHash(java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties)
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(java.lang.String caseSensitiveUserName, char[] rawPassword) throws org.alfresco.repo.security.authentication.AuthenticationExceptionDescription copied from interface:MutableAuthenticationDaoCreate a user with the given userName and password- Specified by:
createUserin interfaceMutableAuthenticationDao- Throws:
org.alfresco.repo.security.authentication.AuthenticationException
-
createUser
public void createUser(java.lang.String caseSensitiveUserName, java.lang.String hashedPassword, char[] rawPassword) throws org.alfresco.repo.security.authentication.AuthenticationExceptionDescription 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:
org.alfresco.repo.security.authentication.AuthenticationException
-
updateUser
public void updateUser(java.lang.String userName, char[] rawPassword) throws org.alfresco.repo.security.authentication.AuthenticationExceptionDescription copied from interface:MutableAuthenticationDaoUpdate a user's password.- Specified by:
updateUserin interfaceMutableAuthenticationDao- Throws:
org.alfresco.repo.security.authentication.AuthenticationException
-
deleteUser
public void deleteUser(java.lang.String userName) throws org.alfresco.repo.security.authentication.AuthenticationExceptionDescription copied from interface:MutableAuthenticationDaoDelete a user.- Specified by:
deleteUserin interfaceMutableAuthenticationDao- Throws:
org.alfresco.repo.security.authentication.AuthenticationException
-
getSalt
public java.lang.Object getSalt(net.sf.acegisecurity.UserDetails userDetails)
- Specified by:
getSaltin interfacenet.sf.acegisecurity.providers.dao.SaltSource
-
userExists
public boolean userExists(java.lang.String userName)
Description copied from interface:MutableAuthenticationDaoCheck is a user exists.- Specified by:
userExistsin interfaceMutableAuthenticationDao
-
getUserProperties
protected java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> getUserProperties(java.lang.String userName)
- Returns:
- Returns the user properties or null if there are none
-
getAccountExpires
public boolean getAccountExpires(java.lang.String userName)
Description copied from interface:MutableAuthenticationDaoDoes the account expire?- Specified by:
getAccountExpiresin interfaceMutableAuthenticationDao
-
getAccountExpiryDate
public java.util.Date getAccountExpiryDate(java.lang.String userName)
Description copied from interface:MutableAuthenticationDaoGet the date when this account expires.- Specified by:
getAccountExpiryDatein interfaceMutableAuthenticationDao
-
getAccountHasExpired
public boolean getAccountHasExpired(java.lang.String userName)
Description copied from interface:MutableAuthenticationDaoHas the account expired?- Specified by:
getAccountHasExpiredin interfaceMutableAuthenticationDao
-
getHasExpired
protected boolean getHasExpired(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties, java.lang.Boolean isAdminAuthority)- Parameters:
userName- the usernameproperties- user properties or null to fetch them
-
getLocked
public boolean getLocked(java.lang.String userName)
Description copied from interface:MutableAuthenticationDaoCheck if the account is locked- Specified by:
getLockedin interfaceMutableAuthenticationDao- Parameters:
userName- the username
-
getAccountlocked
public boolean getAccountlocked(java.lang.String userName)
Description copied from interface:MutableAuthenticationDaoIs the account locked?- Specified by:
getAccountlockedin interfaceMutableAuthenticationDao
-
getLocked
protected boolean getLocked(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties, java.lang.Boolean isAdminAuthority)- Parameters:
userName- the usernameproperties- user properties or null to fetch them
-
getCredentialsExpire
public boolean getCredentialsExpire(java.lang.String userName)
Description copied from interface:MutableAuthenticationDaoDo the credentials for the user expire?- Specified by:
getCredentialsExpirein interfaceMutableAuthenticationDao
-
getCredentialsExpire
protected boolean getCredentialsExpire(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties)- Parameters:
userName- the usernameproperties- user properties or null to fetch them
-
getCredentialsExpiryDate
public java.util.Date getCredentialsExpiryDate(java.lang.String userName)
Description copied from interface:MutableAuthenticationDaoGet the date when the credentials/password expire.- Specified by:
getCredentialsExpiryDatein interfaceMutableAuthenticationDao
-
getCredentialsHaveExpired
public boolean getCredentialsHaveExpired(java.lang.String userName)
Description copied from interface:MutableAuthenticationDaoHave the credentials for the user expired?- Specified by:
getCredentialsHaveExpiredin interfaceMutableAuthenticationDao
-
getCredentialsHaveExpired
protected boolean getCredentialsHaveExpired(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties, java.lang.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
public boolean getEnabled(java.lang.String userName)
Description copied from interface:MutableAuthenticationDaoGetter for user enabled- Specified by:
getEnabledin interfaceMutableAuthenticationDao
-
getEnabled
protected boolean getEnabled(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties, java.lang.Boolean isAdminAuthority)- Parameters:
userName- the usernameproperties- the user's properties or null
-
setAccountExpires
public void setAccountExpires(java.lang.String userName, boolean expires)Description copied from interface:MutableAuthenticationDaoSet if the account should expire- Specified by:
setAccountExpiresin interfaceMutableAuthenticationDao
-
setAccountExpiryDate
public void setAccountExpiryDate(java.lang.String userName, java.util.Date expiryDate)Description copied from interface:MutableAuthenticationDaoSet the date on which the account expires- Specified by:
setAccountExpiryDatein interfaceMutableAuthenticationDao
-
setCredentialsExpire
public void setCredentialsExpire(java.lang.String userName, boolean expires)Description copied from interface:MutableAuthenticationDaoSet if the password expires.- Specified by:
setCredentialsExpirein interfaceMutableAuthenticationDao
-
setCredentialsExpiryDate
public void setCredentialsExpiryDate(java.lang.String userName, java.util.Date exipryDate)Description copied from interface:MutableAuthenticationDaoSet the date when credentials expire.- Specified by:
setCredentialsExpiryDatein interfaceMutableAuthenticationDao
-
setEnabled
public void setEnabled(java.lang.String userName, boolean enabled)Description copied from interface:MutableAuthenticationDaoEnable/disable a user.- Specified by:
setEnabledin interfaceMutableAuthenticationDao
-
setLocked
public void setLocked(java.lang.String userName, boolean locked)Description copied from interface:MutableAuthenticationDaoSet if the account is locked.- Specified by:
setLockedin interfaceMutableAuthenticationDao
-
getMD4HashedPassword
public java.lang.String getMD4HashedPassword(java.lang.String userName)
Description copied from interface:MutableAuthenticationDaoGet the MD4 password hash- Specified by:
getMD4HashedPasswordin interfaceMutableAuthenticationDao
-
onUpdateProperties
public void onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> before, java.util.Map<org.alfresco.service.namespace.QName,java.io.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(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> before, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> after)
-
beforeDeleteNode
public void beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Description copied from interface:NodeServicePolicies.BeforeDeleteNodePolicyCalled before a node is deleted.- Specified by:
beforeDeleteNodein interfaceNodeServicePolicies.BeforeDeleteNodePolicy- Parameters:
nodeRef- the node reference
-
-