Class AbstractChainingAuthenticationService

    • Field Detail

      • logger

        protected final org.apache.commons.logging.Log logger
    • Constructor Detail

      • AbstractChainingAuthenticationService

        public AbstractChainingAuthenticationService()
        Instantiates a new abstract chaining authentication service.
    • Method Detail

      • getMutableAuthenticationService

        public abstract MutableAuthenticationService getMutableAuthenticationService()
        Gets the mutable authentication service.
        Returns:
        the mutable authentication service
      • getUsableAuthenticationServices

        protected abstract java.util.List<AuthenticationService> getUsableAuthenticationServices()
        Gets the authentication services across which methods will chain.
        Returns:
        the usable authentication services
      • createAuthentication

        public void createAuthentication​(java.lang.String userName,
                                         char[] password)
                                  throws org.alfresco.repo.security.authentication.AuthenticationException
        Description copied from interface: MutableAuthenticationService
        Create an authentication for the given user.
        Specified by:
        createAuthentication in interface MutableAuthenticationService
        Parameters:
        userName - String
        password - char[]
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • updateAuthentication

        public void updateAuthentication​(java.lang.String userName,
                                         char[] oldPassword,
                                         char[] newPassword)
                                  throws org.alfresco.repo.security.authentication.AuthenticationException
        Description copied from interface: MutableAuthenticationService
        Update the login information for the user (typically called by the user)
        Specified by:
        updateAuthentication in interface MutableAuthenticationService
        Parameters:
        userName - String
        oldPassword - char[]
        newPassword - char[]
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • setAuthentication

        public void setAuthentication​(java.lang.String userName,
                                      char[] newPassword)
                               throws org.alfresco.repo.security.authentication.AuthenticationException
        Set the login information for a user (typically called by an admin user)
        Specified by:
        setAuthentication in interface MutableAuthenticationService
        Parameters:
        userName - String
        newPassword - char[]
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • deleteAuthentication

        public void deleteAuthentication​(java.lang.String userName)
                                  throws org.alfresco.repo.security.authentication.AuthenticationException
        Delete an authentication entry
        Specified by:
        deleteAuthentication in interface MutableAuthenticationService
        Parameters:
        userName - String
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • setAuthenticationEnabled

        public void setAuthenticationEnabled​(java.lang.String userName,
                                             boolean enabled)
                                      throws org.alfresco.repo.security.authentication.AuthenticationException
        Enable or disable an authentication entry
        Specified by:
        setAuthenticationEnabled in interface MutableAuthenticationService
        Parameters:
        userName - String
        enabled - boolean
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • isAuthenticationMutable

        public boolean isAuthenticationMutable​(java.lang.String userName)
        Determines whether this user's authentication may be mutated via the other methods.
        Specified by:
        isAuthenticationMutable in interface MutableAuthenticationService
        Parameters:
        userName - the user ID
        Returns:
        true if this user's authentication may be mutated via the other methods.
      • 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
      • authenticate

        public void authenticate​(java.lang.String userName,
                                 char[] password)
                          throws org.alfresco.repo.security.authentication.AuthenticationException
        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
      • getId

        protected java.lang.String getId​(AuthenticationService authService)
        Should be overridden to returns the ID of the authService for use in debug.
        Parameters:
        authService - in question.
        Returns:
        the ID of the authService. This implementation has no way to work this out so returns the simple class name.
      • authenticateAsGuest

        public void authenticateAsGuest()
                                 throws org.alfresco.repo.security.authentication.AuthenticationException
        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
      • guestUserAuthenticationAllowed

        public boolean guestUserAuthenticationAllowed()
        Check if Guest user authentication is allowed.
        Specified by:
        guestUserAuthenticationAllowed in interface AuthenticationService
        Returns:
        true if Guest user authentication is allowed, false otherwise
      • 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
      • getCurrentUserName

        public java.lang.String getCurrentUserName()
                                            throws org.alfresco.repo.security.authentication.AuthenticationException
        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
        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
        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
        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
      • getDomains

        public java.util.Set<java.lang.String> getDomains()
        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