Class DefaultMutableAuthenticationDao
- java.lang.Object
-
- org.alfresco.repo.security.authentication.DefaultMutableAuthenticationDao
-
- All Implemented Interfaces:
net.sf.acegisecurity.providers.dao.AuthenticationDao,net.sf.acegisecurity.providers.dao.SaltSource,MutableAuthenticationDao
public class DefaultMutableAuthenticationDao extends java.lang.Object implements MutableAuthenticationDao
An authority DAO that has no implementation. By default it will throw an exception if any method is called. Any of the getter/setter methods can be enabled with a no action implementation. This can support deleting users via the UI for LDAP and NTLM. The Alfresco person object is deleted from the UI. The call to delete the user will return with no action. The following methods will always fail. getMD4HashedPassword(String userName) loadUserByUsername(String arg0) getSalt(UserDetails user)- Author:
- Andy Hind
-
-
Constructor Summary
Constructors Constructor Description DefaultMutableAuthenticationDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateUser(java.lang.String userName, 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.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?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?booleangetEnabled(java.lang.String userName)Getter for user enabledbooleangetLocked(java.lang.String userName)Check if the account is lockedjava.lang.StringgetMD4HashedPassword(java.lang.String userName)Get the MD4 password hashjava.lang.ObjectgetSalt(net.sf.acegisecurity.UserDetails user)net.sf.acegisecurity.UserDetailsloadUserByUsername(java.lang.String arg0)voidsetAccountExpires(java.lang.String userName, boolean expires)Set if the account should expirevoidsetAccountExpiryDate(java.lang.String userName, java.util.Date exipryDate)Set the date on which the account expiresvoidsetAllowCreateUser(boolean allowCreateUser)voidsetAllowDeleteUser(boolean allowDeleteUser)voidsetAllowGetAccountExpiryDate(boolean allowGetAccountExpiryDate)voidsetAllowGetAccountHasExpired(boolean allowGetAccountHasExpired)voidsetAllowGetAccountLocked(boolean allowGetAccountLocked)voidsetAllowGetCredentialsExpire(boolean allowGetCredentialsExpire)voidsetAllowGetCredentialsExpiryDate(boolean allowGetCredentialsExpiryDate)voidsetAllowGetCredentialsHaveExpired(boolean allowGetCredentialsHaveExpired)voidsetAllowGetEnabled(boolean allowGetEnabled)voidsetAllowSetAccountExpires(boolean allowSetAccountExpires)voidsetAllowSetAccountExpiryDate(boolean allowSetAccountExpiryDate)voidsetAllowSetAccountLocked(boolean allowSetAccountLocked)voidsetAllowSetCredentialsExpire(boolean allowSetCredentialsExpire)voidsetAllowSetCredentialsExpiryDate(boolean allowSetCredentialsExpiryDate)voidsetAllowSetEnabled(boolean allowSetEnabled)voidsetAllowUpdateUser(boolean allowUpdateUser)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.voidupdateUser(java.lang.String userName, char[] rawPassword)Update a user's password.booleanuserExists(java.lang.String userName)Check is a user exists.
-
-
-
Method Detail
-
createUser
public void createUser(java.lang.String userName, char[] rawPassword) throws org.alfresco.repo.security.authentication.AuthenticationExceptionCreate a user with the given userName and password If enabled does nothing- Specified by:
createUserin interfaceMutableAuthenticationDao- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowedorg.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.AuthenticationExceptionCreate 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. If enabled does nothing- Specified by:
createUserin interfaceMutableAuthenticationDao- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowedorg.alfresco.repo.security.authentication.AuthenticationException
-
updateUser
public void updateUser(java.lang.String userName, char[] rawPassword) throws org.alfresco.repo.security.authentication.AuthenticationExceptionUpdate a user's password. If enabled does nothing- Specified by:
updateUserin interfaceMutableAuthenticationDao- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowedorg.alfresco.repo.security.authentication.AuthenticationException
-
deleteUser
public void deleteUser(java.lang.String userName) throws org.alfresco.repo.security.authentication.AuthenticationExceptionDelete a user. If enabled does nothing- Specified by:
deleteUserin interfaceMutableAuthenticationDao- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowedorg.alfresco.repo.security.authentication.AuthenticationException
-
userExists
public boolean userExists(java.lang.String userName)
Check is a user exists.- Specified by:
userExistsin interfaceMutableAuthenticationDao- Returns:
- true always
-
setEnabled
public void setEnabled(java.lang.String userName, boolean enabled)Enable/disable a user. If enabled does nothing- Specified by:
setEnabledin interfaceMutableAuthenticationDao- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowed
-
getEnabled
public boolean getEnabled(java.lang.String userName)
Getter for user enabled- Specified by:
getEnabledin interfaceMutableAuthenticationDao- Returns:
- true if enabled
- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowed
-
setAccountExpires
public void setAccountExpires(java.lang.String userName, boolean expires)Set if the account should expire If enabled does nothing- Specified by:
setAccountExpiresin interfaceMutableAuthenticationDao- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowed
-
getAccountExpires
public boolean getAccountExpires(java.lang.String userName)
Does the account expire?- Specified by:
getAccountExpiresin interfaceMutableAuthenticationDao- Returns:
- false if enabled
- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowed
-
getAccountHasExpired
public boolean getAccountHasExpired(java.lang.String userName)
Has the account expired?- Specified by:
getAccountHasExpiredin interfaceMutableAuthenticationDao- Returns:
- false if enabled
- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowed
-
setCredentialsExpire
public void setCredentialsExpire(java.lang.String userName, boolean expires)Set if the password expires. If enabled does nothing- Specified by:
setCredentialsExpirein interfaceMutableAuthenticationDao- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowed
-
getCredentialsExpire
public boolean getCredentialsExpire(java.lang.String userName)
Do the credentials for the user expire?- Specified by:
getCredentialsExpirein interfaceMutableAuthenticationDao- Returns:
- false if enabled
- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowed
-
getCredentialsHaveExpired
public boolean getCredentialsHaveExpired(java.lang.String userName)
Have the credentials for the user expired?- Specified by:
getCredentialsHaveExpiredin interfaceMutableAuthenticationDao- Returns:
- false if enabled
- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowed
-
setLocked
public void setLocked(java.lang.String userName, boolean locked)Set if the account is locked. If enabled does nothing- Specified by:
setLockedin interfaceMutableAuthenticationDao- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowed
-
getLocked
public boolean getLocked(java.lang.String userName)
Check if the account is locked If enabled does nothing- Specified by:
getLockedin interfaceMutableAuthenticationDao- Parameters:
userName- the username- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowed
-
getAccountlocked
public boolean getAccountlocked(java.lang.String userName)
Description copied from interface:MutableAuthenticationDaoIs the account locked?- Specified by:
getAccountlockedin interfaceMutableAuthenticationDao- See Also:
getLocked(String)
-
setAccountExpiryDate
public void setAccountExpiryDate(java.lang.String userName, java.util.Date exipryDate)Set the date on which the account expires If enabled does nothing- Specified by:
setAccountExpiryDatein interfaceMutableAuthenticationDao- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowed
-
getAccountExpiryDate
public java.util.Date getAccountExpiryDate(java.lang.String userName)
Get the date when this account expires.- Specified by:
getAccountExpiryDatein interfaceMutableAuthenticationDao- Returns:
- null if enabled
- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowed
-
setCredentialsExpiryDate
public void setCredentialsExpiryDate(java.lang.String userName, java.util.Date exipryDate)Set the date when credentials expire. If enabled does nothing- Specified by:
setCredentialsExpiryDatein interfaceMutableAuthenticationDao- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowed
-
getCredentialsExpiryDate
public java.util.Date getCredentialsExpiryDate(java.lang.String userName)
Get the date when the credentials/password expire.- Specified by:
getCredentialsExpiryDatein interfaceMutableAuthenticationDao- Returns:
- null if enabled
- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the operation is not allowed
-
getMD4HashedPassword
public java.lang.String getMD4HashedPassword(java.lang.String userName)
Description copied from interface:MutableAuthenticationDaoGet the MD4 password hash- Specified by:
getMD4HashedPasswordin interfaceMutableAuthenticationDao- Throws:
org.alfresco.error.AlfrescoRuntimeException- always
-
loadUserByUsername
public net.sf.acegisecurity.UserDetails loadUserByUsername(java.lang.String arg0) throws net.sf.acegisecurity.providers.dao.UsernameNotFoundException, org.springframework.dao.DataAccessException- Specified by:
loadUserByUsernamein interfacenet.sf.acegisecurity.providers.dao.AuthenticationDao- Throws:
org.alfresco.error.AlfrescoRuntimeException- alwaysnet.sf.acegisecurity.providers.dao.UsernameNotFoundExceptionorg.springframework.dao.DataAccessException
-
getSalt
public java.lang.Object getSalt(net.sf.acegisecurity.UserDetails user)
- Specified by:
getSaltin interfacenet.sf.acegisecurity.providers.dao.SaltSource- Throws:
org.alfresco.error.AlfrescoRuntimeException- always
-
setAllowCreateUser
public void setAllowCreateUser(boolean allowCreateUser)
-
setAllowDeleteUser
public void setAllowDeleteUser(boolean allowDeleteUser)
-
setAllowGetAccountExpiryDate
public void setAllowGetAccountExpiryDate(boolean allowGetAccountExpiryDate)
-
setAllowGetAccountHasExpired
public void setAllowGetAccountHasExpired(boolean allowGetAccountHasExpired)
-
setAllowGetAccountLocked
public void setAllowGetAccountLocked(boolean allowGetAccountLocked)
-
setAllowGetCredentialsExpire
public void setAllowGetCredentialsExpire(boolean allowGetCredentialsExpire)
-
setAllowGetCredentialsExpiryDate
public void setAllowGetCredentialsExpiryDate(boolean allowGetCredentialsExpiryDate)
-
setAllowGetCredentialsHaveExpired
public void setAllowGetCredentialsHaveExpired(boolean allowGetCredentialsHaveExpired)
-
setAllowGetEnabled
public void setAllowGetEnabled(boolean allowGetEnabled)
-
setAllowSetAccountExpires
public void setAllowSetAccountExpires(boolean allowSetAccountExpires)
-
setAllowSetAccountExpiryDate
public void setAllowSetAccountExpiryDate(boolean allowSetAccountExpiryDate)
-
setAllowSetAccountLocked
public void setAllowSetAccountLocked(boolean allowSetAccountLocked)
-
setAllowSetCredentialsExpire
public void setAllowSetCredentialsExpire(boolean allowSetCredentialsExpire)
-
setAllowSetCredentialsExpiryDate
public void setAllowSetCredentialsExpiryDate(boolean allowSetCredentialsExpiryDate)
-
setAllowSetEnabled
public void setAllowSetEnabled(boolean allowSetEnabled)
-
setAllowUpdateUser
public void setAllowUpdateUser(boolean allowUpdateUser)
-
-