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 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 Details

    • DefaultMutableAuthenticationDao

      public DefaultMutableAuthenticationDao()
  • Method Details

    • createUser

      public void createUser(String userName, char[] rawPassword) throws AuthenticationException
      Create a user with the given userName and password

      If enabled does nothing

      Specified by:
      createUser in interface MutableAuthenticationDao
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
      AuthenticationException
    • createUser

      public void createUser(String caseSensitiveUserName, String hashedpassword, char[] rawPassword) throws AuthenticationException
      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. 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:
      createUser in interface MutableAuthenticationDao
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
      AuthenticationException
    • updateUser

      public void updateUser(String userName, char[] rawPassword) throws AuthenticationException
      Update a user's password.

      If enabled does nothing

      Specified by:
      updateUser in interface MutableAuthenticationDao
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
      AuthenticationException
    • deleteUser

      public void deleteUser(String userName) throws AuthenticationException
      Delete a user.

      If enabled does nothing

      Specified by:
      deleteUser in interface MutableAuthenticationDao
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
      AuthenticationException
    • userExists

      public boolean userExists(String userName)
      Check is a user exists.
      Specified by:
      userExists in interface MutableAuthenticationDao
      Returns:
      true always
    • setEnabled

      public void setEnabled(String userName, boolean enabled)
      Enable/disable a user.

      If enabled does nothing

      Specified by:
      setEnabled in interface MutableAuthenticationDao
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
    • getEnabled

      public boolean getEnabled(String userName)
      Getter for user enabled
      Specified by:
      getEnabled in interface MutableAuthenticationDao
      Returns:
      true if enabled
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
    • setAccountExpires

      public void setAccountExpires(String userName, boolean expires)
      Set if the account should expire

      If enabled does nothing

      Specified by:
      setAccountExpires in interface MutableAuthenticationDao
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
    • getAccountExpires

      public boolean getAccountExpires(String userName)
      Does the account expire?
      Specified by:
      getAccountExpires in interface MutableAuthenticationDao
      Returns:
      false if enabled
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
    • getAccountHasExpired

      public boolean getAccountHasExpired(String userName)
      Has the account expired?
      Specified by:
      getAccountHasExpired in interface MutableAuthenticationDao
      Returns:
      false if enabled
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
    • setCredentialsExpire

      public void setCredentialsExpire(String userName, boolean expires)
      Set if the password expires.

      If enabled does nothing

      Specified by:
      setCredentialsExpire in interface MutableAuthenticationDao
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
    • getCredentialsExpire

      public boolean getCredentialsExpire(String userName)
      Do the credentials for the user expire?
      Specified by:
      getCredentialsExpire in interface MutableAuthenticationDao
      Returns:
      false if enabled
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
    • getCredentialsHaveExpired

      public boolean getCredentialsHaveExpired(String userName)
      Have the credentials for the user expired?
      Specified by:
      getCredentialsHaveExpired in interface MutableAuthenticationDao
      Returns:
      false if enabled
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
    • setLocked

      public void setLocked(String userName, boolean locked)
      Set if the account is locked.

      If enabled does nothing

      Specified by:
      setLocked in interface MutableAuthenticationDao
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
    • getLocked

      public boolean getLocked(String userName)
      Check if the account is locked

      If enabled does nothing

      Specified by:
      getLocked in interface MutableAuthenticationDao
      Parameters:
      userName - the username
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
    • getAccountlocked

      public boolean getAccountlocked(String userName)
      Description copied from interface: MutableAuthenticationDao
      Is the account locked?
      Specified by:
      getAccountlocked in interface MutableAuthenticationDao
      See Also:
    • setAccountExpiryDate

      public void setAccountExpiryDate(String userName, Date exipryDate)
      Set the date on which the account expires

      If enabled does nothing

      Specified by:
      setAccountExpiryDate in interface MutableAuthenticationDao
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
    • getAccountExpiryDate

      public Date getAccountExpiryDate(String userName)
      Get the date when this account expires.

      Specified by:
      getAccountExpiryDate in interface MutableAuthenticationDao
      Returns:
      null if enabled
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
    • setCredentialsExpiryDate

      public void setCredentialsExpiryDate(String userName, Date exipryDate)
      Set the date when credentials expire.

      If enabled does nothing

      Specified by:
      setCredentialsExpiryDate in interface MutableAuthenticationDao
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
    • getCredentialsExpiryDate

      public Date getCredentialsExpiryDate(String userName)
      Get the date when the credentials/password expire.

      Specified by:
      getCredentialsExpiryDate in interface MutableAuthenticationDao
      Returns:
      null if enabled
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the the operation is not allowed
    • getMD4HashedPassword

      public String getMD4HashedPassword(String userName)
      Description copied from interface: MutableAuthenticationDao
      Get the MD4 password hash
      Specified by:
      getMD4HashedPassword in interface MutableAuthenticationDao
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - always
    • loadUserByUsername

      public net.sf.acegisecurity.UserDetails loadUserByUsername(String arg0) throws net.sf.acegisecurity.providers.dao.UsernameNotFoundException, org.springframework.dao.DataAccessException
      Specified by:
      loadUserByUsername in interface net.sf.acegisecurity.providers.dao.AuthenticationDao
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - always
      net.sf.acegisecurity.providers.dao.UsernameNotFoundException
      org.springframework.dao.DataAccessException
    • getSalt

      public Object getSalt(net.sf.acegisecurity.UserDetails user)
      Specified by:
      getSalt in interface net.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)