Class AbstractAuthenticationComponent

    • Field Detail

      • logger

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

      • AbstractAuthenticationComponent

        public AbstractAuthenticationComponent()
    • Method Detail

      • setAllowGuestLogin

        public void setAllowGuestLogin​(java.lang.Boolean allowGuestLogin)
        Set if guest login is supported.
        Parameters:
        allowGuestLogin - Boolean
      • setAuthenticationContext

        public void setAuthenticationContext​(AuthenticationContext authenticationContext)
      • setPersonService

        public void setPersonService​(PersonService personService)
      • setNodeService

        public void setNodeService​(org.alfresco.service.cmr.repository.NodeService nodeService)
      • setTransactionService

        public void setTransactionService​(TransactionService transactionService)
      • setUserRegistrySynchronizer

        public void setUserRegistrySynchronizer​(UserRegistrySynchronizer userRegistrySynchronizer)
      • getAllowGuestLogin

        public java.lang.Boolean getAllowGuestLogin()
      • getNodeService

        public org.alfresco.service.cmr.repository.NodeService getNodeService()
      • authenticate

        public void authenticate​(java.lang.String userName,
                                 char[] password)
                          throws org.alfresco.repo.security.authentication.AuthenticationException
        Description copied from interface: AuthenticationComponent
        Authenticate
        Specified by:
        authenticate in interface AuthenticationComponent
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • authenticateImpl

        protected void authenticateImpl​(java.lang.String userName,
                                        char[] password)
        Default unsupported authentication implementation - as of 2.1 this is the best way to implement your own authentication component as it will support guest login - prior to this direct over ride for authenticate(String , char[]) was used. This will still work.
        Parameters:
        userName - String
        password - char[]
      • setCurrentUser

        public net.sf.acegisecurity.Authentication setCurrentUser​(java.lang.String userName)
                                                           throws org.alfresco.repo.security.authentication.AuthenticationException
        Description copied from interface: AuthenticationComponent
        Explicitly set the current user to be authenticated.
        Specified by:
        setCurrentUser in interface AuthenticationComponent
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • getUserDetails

        protected net.sf.acegisecurity.UserDetails getUserDetails​(java.lang.String userName)
        Default implementation that makes an ACEGI object on the fly
        Parameters:
        userName - String
        Returns:
        UserDetails
      • setCurrentAuthentication

        public net.sf.acegisecurity.Authentication setCurrentAuthentication​(net.sf.acegisecurity.Authentication authentication)
        Description copied from interface: AuthenticationContext
        Explicitly set the current suthentication. If the authentication is null the the current authentication is cleared.
        Specified by:
        setCurrentAuthentication in interface AuthenticationContext
        Parameters:
        authentication - the current authentication (may be null).
        Returns:
        Returns the modified authentication instance or null if it was cleared.
      • getCurrentAuthentication

        public net.sf.acegisecurity.Authentication getCurrentAuthentication()
                                                                     throws org.alfresco.repo.security.authentication.AuthenticationException
        Get the current authentication context
        Specified by:
        getCurrentAuthentication in interface AuthenticationContext
        Returns:
        Authentication
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • getCurrentUserName

        public java.lang.String getCurrentUserName()
                                            throws org.alfresco.repo.security.authentication.AuthenticationException
        Get the current user name.
        Specified by:
        getCurrentUserName in interface AuthenticationContext
        Returns:
        String
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • setSystemUserAsCurrentUser

        public net.sf.acegisecurity.Authentication setSystemUserAsCurrentUser()
        Set the system user as the current user note: for MT, will set to default domain only
        Specified by:
        setSystemUserAsCurrentUser in interface AuthenticationContext
        Returns:
        Authentication
      • getSystemUserName

        public java.lang.String getSystemUserName()
        Get the name of the system user note: for MT, will get system for default domain only
        Specified by:
        getSystemUserName in interface AuthenticationContext
        Returns:
        String
      • isSystemUserName

        public boolean isSystemUserName​(java.lang.String userName)
        Is this the system user ?
        Specified by:
        isSystemUserName in interface AuthenticationContext
        Returns:
        boolean
      • getGuestUserName

        public java.lang.String getGuestUserName()
        Get the name of the Guest User note: for MT, will get guest for default domain only
        Specified by:
        getGuestUserName in interface AuthenticationContext
        Returns:
        String
      • setGuestUserAsCurrentUser

        public net.sf.acegisecurity.Authentication setGuestUserAsCurrentUser()
                                                                      throws org.alfresco.repo.security.authentication.AuthenticationException
        Set the guest user as the current user. note: for MT, will set to default domain only
        Specified by:
        setGuestUserAsCurrentUser in interface AuthenticationComponent
        Throws:
        org.alfresco.repo.security.authentication.AuthenticationException
      • implementationAllowsGuestLogin

        protected abstract boolean implementationAllowsGuestLogin()
      • getDefaultAdministratorUserNames

        public java.util.Set<java.lang.String> getDefaultAdministratorUserNames()
        Gets a set of user names who for this particular authentication system should be considered administrators by default. If the security framework is case sensitive these values should be case sensitive user names. If the security framework is not case sensitive these values should be the lower-case user names.
        Specified by:
        getDefaultAdministratorUserNames in interface AuthenticationComponent
        Returns:
        a set of user names
      • setDefaultAdministratorUserNames

        public void setDefaultAdministratorUserNames​(java.util.Set<java.lang.String> defaultAdministratorUserNames)
        Sets the user names who for this particular authentication system should be considered administrators by default.
        Parameters:
        defaultAdministratorUserNames - a set of user names
      • setDefaultAdministratorUserNameList

        public void setDefaultAdministratorUserNameList​(java.lang.String defaultAdministratorUserNames)
        Convenience method to allow the administrator user names to be specified as a comma separated list
        Parameters:
        defaultAdministratorUserNames - String
      • getDefaultGuestUserNames

        public java.util.Set<java.lang.String> getDefaultGuestUserNames()
        Description copied from interface: AuthenticationComponent
        Gets a set of user names who for this particular authentication system should be considered guests by default. If the security framework is case sensitive these values should be case sensitive user names. If the security framework is not case sensitive these values should be the lower-case user names.
        Specified by:
        getDefaultGuestUserNames in interface AuthenticationComponent
        Returns:
        a set of user names
      • setDefaultGuestUserNames

        public void setDefaultGuestUserNames​(java.util.Set<java.lang.String> defaultGuestUserNames)
        Sets the user names who for this particular authentication system should be considered administrators by default.
        Parameters:
        defaultGuestUserNames - a set of user names
      • setDefaultGuestUserNameList

        public void setDefaultGuestUserNameList​(java.lang.String defaultGuestUserNames)
        Convenience method to allow the administrator user names to be specified as a comma separated list
        Parameters:
        defaultGuestUserNames - String
      • getUserDomain

        public java.lang.String getUserDomain​(java.lang.String userName)
        Description copied from interface: AuthenticationContext
        Extracts the tenant domain name from a user name
        Specified by:
        getUserDomain in interface AuthenticationContext
        Parameters:
        userName - a user name
        Returns:
        a tenant domain name
      • setUserDetails

        public net.sf.acegisecurity.Authentication setUserDetails​(net.sf.acegisecurity.UserDetails ud)
        Description copied from interface: AuthenticationContext
        Explicitly set the given validated user details to be authenticated.
        Specified by:
        setUserDetails in interface AuthenticationContext
        Parameters:
        ud - the User Details
        Returns:
        Authentication
      • onAuthenticate

        protected void onAuthenticate()
      • onFail

        protected void onFail()
      • getNumberSuccessfulAuthentications

        public int getNumberSuccessfulAuthentications()
      • getNumberFailedAuthentications

        public int getNumberFailedAuthentications()