Class AuthenticationServiceImpl

    • Constructor Detail

      • AuthenticationServiceImpl

        public AuthenticationServiceImpl()
    • Method Detail

      • setProtectionPeriodSeconds

        public void setProtectionPeriodSeconds​(int protectionPeriodSeconds)
      • setProtectionEnabled

        public void setProtectionEnabled​(boolean protectionEnabled)
      • isProtectionEnabled

        public boolean isProtectionEnabled()
      • setProtectionLimit

        public void setProtectionLimit​(int protectionLimit)
      • setProtectedUsersCache

        public void setProtectedUsersCache​(org.alfresco.repo.cache.SimpleCache<java.lang.String,​org.alfresco.repo.security.authentication.ProtectedUser> protectedUsersCache)
      • setPersonService

        public void setPersonService​(PersonService personService)
      • setTicketComponent

        public void setTicketComponent​(org.alfresco.repo.security.authentication.TicketComponent ticketComponent)
      • setAuthenticationComponent

        public void setAuthenticationComponent​(AuthenticationComponent authenticationComponent)
      • isActive

        public boolean isActive()
        Description copied from interface: ActivateableBean
        Determines whether this bean is active.
        Specified by:
        isActive in interface ActivateableBean
        Returns:
        true if this bean is active
      • authenticate

        public void authenticate​(java.lang.String userName,
                                 char[] password)
                          throws org.alfresco.repo.security.authentication.AuthenticationException
        Description copied from interface: AuthenticationService
        Carry out an authentication attempt. If successful the user is set to the current user. The current user is a part of the thread context.
        Specified by:
        authenticate in interface AuthenticationService
        Parameters:
        userName - the username
        password - the passowrd
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • isUserProtected

        public boolean isUserProtected​(java.lang.String userName)
        Returns:
        true if user is 'protected' from brute force attack
      • recordFailedAuthentication

        public void recordFailedAuthentication​(java.lang.String userName)
        Method records a failed login attempt. If the number of recorded failures exceeds protectionLimit the user will be considered 'protected'.
      • getProtectedUserKey

        public java.lang.String getProtectedUserKey​(java.lang.String userName)
        Creates a key by combining the service instance ID with the username. This are the type of keys maintained by protectedUsersCache map.
      • getCurrentUserName

        public java.lang.String getCurrentUserName()
                                            throws org.alfresco.repo.security.authentication.AuthenticationException
        Description copied from interface: AuthenticationService
        Get the name of the currently authenticated user.
        Specified by:
        getCurrentUserName in interface AuthenticationService
        Returns:
        String
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • invalidateUserSession

        public void invalidateUserSession​(java.lang.String userName)
                                   throws org.alfresco.repo.security.authentication.AuthenticationException
        Description copied from interface: AuthenticationService
        Invalidate any tickets held by the user.
        Specified by:
        invalidateUserSession in interface AuthenticationService
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • invalidateTicket

        public void invalidateTicket​(java.lang.String ticket)
                              throws org.alfresco.repo.security.authentication.AuthenticationException
        Description copied from interface: AuthenticationService
        Invalidate a single ticket by ID
        Specified by:
        invalidateTicket in interface AuthenticationService
        Parameters:
        ticket - String
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • validate

        public void validate​(java.lang.String ticket)
                      throws org.alfresco.repo.security.authentication.AuthenticationException
        Description copied from interface: AuthenticationService
        Validate a ticket. Set the current user name accordingly.
        Specified by:
        validate in interface AuthenticationService
        Parameters:
        ticket - String
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • getPrevalidationTenantDomain

        protected java.lang.String getPrevalidationTenantDomain()
        This method is called from the validate(String) method. If this method returns null then the user's tenant will be obtained from the username. This is generally correct in the case where the user can be associated with just one tenant. Override this method in order to force the selection of a different tenant (for whatever reason).
        Returns:
        String
      • getCurrentTicket

        public java.lang.String getCurrentTicket()
                                          throws org.alfresco.repo.security.authentication.AuthenticationException
        Description copied from interface: AuthenticationService
        Get the current ticket as a string
        Specified by:
        getCurrentTicket in interface AuthenticationService
        Returns:
        String
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • authenticateAsGuest

        public void authenticateAsGuest()
                                 throws org.alfresco.repo.security.authentication.AuthenticationException
        Description copied from interface: AuthenticationService
        Authenticate as the guest user. This may not be allowed and throw an exception.
        Specified by:
        authenticateAsGuest in interface AuthenticationService
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • getAllowsUserCreation

        public boolean getAllowsUserCreation()
      • setAllowsUserCreation

        public void setAllowsUserCreation​(boolean allowsUserCreation)
      • getAllowsUserDeletion

        public boolean getAllowsUserDeletion()
      • setAllowsUserDeletion

        public void setAllowsUserDeletion​(boolean allowsUserDeletion)
      • getAllowsUserPasswordChange

        public boolean getAllowsUserPasswordChange()
      • setAllowsUserPasswordChange

        public void setAllowsUserPasswordChange​(boolean allowsUserPasswordChange)
      • getDomain

        public java.lang.String getDomain()
      • setDomain

        public void setDomain​(java.lang.String domain)
      • getDomains

        public java.util.Set<java.lang.String> getDomains()
        Description copied from interface: AuthenticationService
        Get the domain to which this instance of an authentication service applies.
        Specified by:
        getDomains in interface AuthenticationService
        Returns:
        The domain name
      • getDefaultAdministratorUserNames

        public java.util.Set<java.lang.String> getDefaultAdministratorUserNames()
        Gets a set of user names who should be considered 'administrators' by default.
        Specified by:
        getDefaultAdministratorUserNames in interface AuthenticationService
        Returns:
        a set of user names
      • getDefaultGuestUserNames

        public java.util.Set<java.lang.String> getDefaultGuestUserNames()
        Gets a set of user names who should be considered 'guests' by default.
        Specified by:
        getDefaultGuestUserNames in interface AuthenticationService
        Returns:
        a set of user names
      • authenticationExists

        public boolean authenticationExists​(java.lang.String userName)
        Check if the given authentication exists.
        Specified by:
        authenticationExists in interface AuthenticationService
        Parameters:
        userName - the username
        Returns:
        Returns true if the authentication exists
      • getAuthenticationEnabled

        public boolean getAuthenticationEnabled​(java.lang.String userName)
                                         throws org.alfresco.repo.security.authentication.AuthenticationException
        Is an authentication enabled or disabled?
        Specified by:
        getAuthenticationEnabled in interface AuthenticationService
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException