Class RepositoryAuthenticationDao

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy

        Policy.Arg
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterPropertiesSet()  
      void beforeDeleteNode​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Called before a node is deleted.
      void createUser​(java.lang.String caseSensitiveUserName, char[] rawPassword)
      Create a user with the given userName and password
      void createUser​(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.
      void deleteUser​(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.
      boolean getAccountExpires​(java.lang.String userName)
      Does the account expire?
      java.util.Date getAccountExpiryDate​(java.lang.String userName)
      Get the date when this account expires.
      boolean getAccountHasExpired​(java.lang.String userName)
      Has the account expired?
      boolean getAccountlocked​(java.lang.String userName)
      Is the account locked?
      boolean getCredentialsExpire​(java.lang.String userName)
      Do the credentials for the user expire?
      protected boolean getCredentialsExpire​(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> properties)  
      java.util.Date getCredentialsExpiryDate​(java.lang.String userName)
      Get the date when the credentials/password expire.
      boolean getCredentialsHaveExpired​(java.lang.String userName)
      Have the credentials for the user expired?
      protected boolean getCredentialsHaveExpired​(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> properties, java.lang.Boolean isAdminAuthority)  
      boolean getEnabled​(java.lang.String userName)
      Getter for user enabled
      protected boolean getEnabled​(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> properties, java.lang.Boolean isAdminAuthority)  
      protected boolean getHasExpired​(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> properties, java.lang.Boolean isAdminAuthority)  
      boolean getLocked​(java.lang.String userName)
      Check if the account is locked
      protected boolean getLocked​(java.lang.String userName, java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> properties, java.lang.Boolean isAdminAuthority)  
      java.lang.String getMD4HashedPassword​(java.lang.String userName)
      Get the MD4 password hash
      java.lang.Object getSalt​(net.sf.acegisecurity.UserDetails userDetails)  
      org.alfresco.service.cmr.repository.NodeRef getUserOrNull​(java.lang.String caseSensitiveSearchUserName)  
      protected java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> getUserProperties​(java.lang.String userName)  
      net.sf.acegisecurity.UserDetails loadUserByUsername​(java.lang.String incomingUserName)  
      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)
      Called after a node's properties have been changed.
      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)  
      void setAccountExpires​(java.lang.String userName, boolean expires)
      Set if the account should expire
      void setAccountExpiryDate​(java.lang.String userName, java.util.Date expiryDate)
      Set the date on which the account expires
      void setAuthenticationCache​(org.alfresco.repo.cache.SimpleCache<java.lang.String,​org.alfresco.repo.security.authentication.RepositoryAuthenticationDao.CacheEntry> authenticationCache)  
      void setAuthorityService​(AuthorityService authorityService)  
      void setCompositePasswordEncoder​(CompositePasswordEncoder compositePasswordEncoder)  
      void setCredentialsExpire​(java.lang.String userName, boolean expires)
      Set if the password expires.
      void setCredentialsExpiryDate​(java.lang.String userName, java.util.Date exipryDate)
      Set the date when credentials expire.
      void setEnabled​(java.lang.String userName, boolean enabled)
      Enable/disable a user.
      void setLocked​(java.lang.String userName, boolean locked)
      Set if the account is locked.
      void setNamespaceService​(org.alfresco.service.namespace.NamespacePrefixResolver namespacePrefixResolver)  
      void setNodeService​(org.alfresco.service.cmr.repository.NodeService nodeService)  
      void setPolicyComponent​(PolicyComponent policyComponent)  
      void setSingletonCache​(org.alfresco.repo.cache.SimpleCache<java.lang.String,​org.alfresco.service.cmr.repository.NodeRef> singletonCache)  
      void setTenantService​(org.alfresco.repo.tenant.TenantService tenantService)  
      void setTransactionService​(TransactionService transactionService)  
      void updateUser​(java.lang.String userName, char[] rawPassword)
      Update a user's password.
      boolean userExists​(java.lang.String userName)
      Check is a user exists.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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
    • Constructor Detail

      • RepositoryAuthenticationDao

        public RepositoryAuthenticationDao()
    • 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:
        afterPropertiesSet in interface org.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:
        loadUserByUsername in interface net.sf.acegisecurity.providers.dao.AuthenticationDao
        Throws:
        net.sf.acegisecurity.providers.dao.UsernameNotFoundException
        org.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.AuthenticationException
        Description copied from interface: MutableAuthenticationDao
        Create a user with the given userName and password
        Specified by:
        createUser in interface MutableAuthenticationDao
        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.AuthenticationException
        Description copied from interface: MutableAuthenticationDao
        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.
        Specified by:
        createUser in interface MutableAuthenticationDao
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • updateUser

        public void updateUser​(java.lang.String userName,
                               char[] rawPassword)
                        throws org.alfresco.repo.security.authentication.AuthenticationException
        Description copied from interface: MutableAuthenticationDao
        Update a user's password.
        Specified by:
        updateUser in interface MutableAuthenticationDao
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • deleteUser

        public void deleteUser​(java.lang.String userName)
                        throws org.alfresco.repo.security.authentication.AuthenticationException
        Description copied from interface: MutableAuthenticationDao
        Delete a user.
        Specified by:
        deleteUser in interface MutableAuthenticationDao
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • getSalt

        public java.lang.Object getSalt​(net.sf.acegisecurity.UserDetails userDetails)
        Specified by:
        getSalt in interface net.sf.acegisecurity.providers.dao.SaltSource
      • 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
      • 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 username
        properties - user properties or null to fetch them
      • 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 username
        properties - user properties or null to fetch them
      • getCredentialsExpire

        protected boolean getCredentialsExpire​(java.lang.String userName,
                                               java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> properties)
        Parameters:
        userName - the username
        properties - user properties or null to fetch them
      • 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 null
        properties - the properties associated with the user or null to get them
        isAdminAuthority - is admin authority
        Returns:
        true if the user account has expired
      • 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 username
        properties - the user's properties or null
      • 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.OnUpdatePropertiesPolicy
        Called after a node's properties have been changed.
        Specified by:
        onUpdateProperties in interface NodeServicePolicies.OnUpdatePropertiesPolicy
        Parameters:
        nodeRef - reference to the updated node
        before - the node's properties before the change
        after - 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)