Class CifsAuthenticatorBase

  • All Implemented Interfaces:
    org.alfresco.jlan.server.auth.ICifsAuthenticator, ActivateableBean, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean
    Direct Known Subclasses:
    AlfrescoCifsAuthenticator, EnterpriseCifsAuthenticator, PassthruCifsAuthenticator

    public abstract class CifsAuthenticatorBase
    extends org.alfresco.jlan.server.auth.CifsAuthenticator
    implements ActivateableBean, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
    CIFS Authenticator Base Class

    Base class for Alfresco CIFS authenticator implementations.

    Author:
    gkspencer
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static org.apache.commons.logging.Log logger  
      protected MD4PasswordEncoder m_md4Encoder
      The m_md4 encoder.
      • Fields inherited from class org.alfresco.jlan.server.auth.CifsAuthenticator

        GUEST_USERNAME, m_config, m_random
      • Fields inherited from interface org.alfresco.jlan.server.auth.ICifsAuthenticator

        AUTH_ACCDISABLED, AUTH_ALLOW, AUTH_BADPASSWORD, AUTH_BADUSER, AUTH_DISALLOW, AUTH_GUEST, AUTH_PASSEXPIRED, LANMAN, NoAccess, NTLM1, NTLM2, ReadOnly, SHARE_MODE, STANDARD_CHALLENGE_LEN, STANDARD_PASSWORD_LEN, USER_MODE, Writeable
    • Constructor Summary

      Constructors 
      Constructor Description
      CifsAuthenticatorBase()
      Instantiates a new cifs authenticator base.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterPropertiesSet()  
      protected void checkForAdminUserName​(org.alfresco.jlan.server.auth.ClientInfo cInfo)
      Check if the user is an administrator user name.
      void destroy()
      Handle tidy up on container shutdown.
      protected void doGuestLogon​(org.alfresco.jlan.server.auth.ClientInfo client, org.alfresco.jlan.server.SrvSession sess)
      Logon using the guest user account.
      protected <T> T doInTransaction​(RetryingTransactionHelper.RetryingTransactionCallback<T> callback)
      Does work in a transaction.
      protected AuthenticationComponent getAuthenticationComponent()
      Return the authentication component.
      protected AuthenticationService getAuthenticationService()
      Return the authentication service.
      protected AuthorityService getAuthorityService()
      Return the authority service.
      protected void getHomeFolderForUser​(org.alfresco.jlan.server.auth.ClientInfo client)
      Get the home folder for the user.
      protected org.alfresco.service.cmr.repository.NodeService getNodeService()
      Return the node service.
      protected NLTMAuthenticator getNTLMAuthenticator()
      Returns an SSO-enabled authentication component.
      protected PersonService getPersonService()
      Return the person service.
      void initialize()
      Initialize the authenticator.
      void initialize​(org.alfresco.jlan.server.config.ServerConfiguration config, org.springframework.extensions.config.ConfigElement params)
      Initialize the authenticator.
      boolean isActive()
      Determines whether this bean is active.
      java.lang.String mapUserNameToPerson​(java.lang.String userName, boolean checkEnabled)
      Map the case insensitive logon name to the internal person object user name.
      void setActive​(boolean active)
      Activates or deactivates the bean.
      void setAuthenticationComponent​(AuthenticationComponent authenticationComponent)
      Sets the authentication component.
      void setAuthenticationService​(AuthenticationService authenticationService)
      Sets the authentication service.
      void setAuthorityService​(AuthorityService authorityService)
      Sets the authority service.
      void setCurrentUser​(org.alfresco.jlan.server.auth.ClientInfo client)
      Set the current authenticated user context for this thread.
      void setDiskInterface​(org.alfresco.jlan.server.filesys.DiskInterface diskInterface)
      Set the filesystem driver for the node service based filesystem.
      void setNodeService​(org.alfresco.service.cmr.repository.NodeService nodeService)
      Sets the node service.
      void setPersonService​(PersonService personService)
      Sets the person service.
      void setTransactionService​(TransactionService transactionService)
      Sets the transaction service.
      protected boolean validateAuthenticationMode()
      Validate that the authentication component supports the required mode.
      • Methods inherited from class org.alfresco.jlan.server.auth.CifsAuthenticator

        allowGuest, authenticateShareConnect, authenticateUser, authenticateUserPlainText, closeAuthenticator, convertPassword, generateEncryptedPassword, generateNegotiateResponse, getAccessMode, getAuthContext, getCIFSConfig, getEnabledDialects, getEncryptionKeyLength, getEncryptor, getGuestUserName, getsecurityConfig, getSecurityMode, getServerCapabilities, getStatusAsString, getUserDetails, hasDebug, hasExtendedSecurity, hasSessionCleanup, mapClientAddressToDomain, mapUnknownUserToGuest, processSessionSetup, setAccessMode, setAllowGuest, setConfig, setDebug, setExtendedSecurity, setGuestUserName, setMapToGuest, setSecurityMode, setSessionCleanup, toString, validatePassword
      • Methods inherited from class java.lang.Object

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

      • logger

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

      • CifsAuthenticatorBase

        public CifsAuthenticatorBase()
        Instantiates a new cifs authenticator base.
    • Method Detail

      • setAuthenticationComponent

        public void setAuthenticationComponent​(AuthenticationComponent authenticationComponent)
        Sets the authentication component.
        Parameters:
        authenticationComponent - the authenticationComponent to set
      • setAuthenticationService

        public void setAuthenticationService​(AuthenticationService authenticationService)
        Sets the authentication service.
        Parameters:
        authenticationService - the authenticationService to set
      • setNodeService

        public void setNodeService​(org.alfresco.service.cmr.repository.NodeService nodeService)
        Sets the node service.
        Parameters:
        nodeService - the nodeService to set
      • setPersonService

        public void setPersonService​(PersonService personService)
        Sets the person service.
        Parameters:
        personService - the personService to set
      • setTransactionService

        public void setTransactionService​(TransactionService transactionService)
        Sets the transaction service.
        Parameters:
        transactionService - the transactionService to set
      • setAuthorityService

        public void setAuthorityService​(AuthorityService authorityService)
        Sets the authority service.
        Parameters:
        authorityService - the authorityService to set
      • setDiskInterface

        public void setDiskInterface​(org.alfresco.jlan.server.filesys.DiskInterface diskInterface)
        Set the filesystem driver for the node service based filesystem.
        Parameters:
        diskInterface - DiskInterface
      • 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
      • setActive

        public void setActive​(boolean active)
        Activates or deactivates the bean.
        Parameters:
        active - true if the bean is active and initialization should complete
      • initialize

        public void initialize​(org.alfresco.jlan.server.config.ServerConfiguration config,
                               org.springframework.extensions.config.ConfigElement params)
                        throws org.alfresco.jlan.server.config.InvalidConfigurationException
        Initialize the authenticator.
        Overrides:
        initialize in class org.alfresco.jlan.server.auth.CifsAuthenticator
        Parameters:
        config - ServerConfiguration
        params - ConfigElement
        Throws:
        org.alfresco.jlan.server.config.InvalidConfigurationException - the invalid configuration exception
        org.alfresco.jlan.server.config.InvalidConfigurationException
      • initialize

        public void initialize()
                        throws org.alfresco.jlan.server.config.InvalidConfigurationException
        Initialize the authenticator.
        Overrides:
        initialize in class org.alfresco.jlan.server.auth.CifsAuthenticator
        Throws:
        org.alfresco.jlan.server.config.InvalidConfigurationException - the invalid configuration exception
        org.alfresco.jlan.server.config.InvalidConfigurationException
      • afterPropertiesSet

        public final void afterPropertiesSet()
                                      throws org.alfresco.jlan.server.config.InvalidConfigurationException
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        org.alfresco.jlan.server.config.InvalidConfigurationException
      • validateAuthenticationMode

        protected boolean validateAuthenticationMode()
        Validate that the authentication component supports the required mode.
        Returns:
        boolean
      • doGuestLogon

        protected void doGuestLogon​(org.alfresco.jlan.server.auth.ClientInfo client,
                                    org.alfresco.jlan.server.SrvSession sess)
        Logon using the guest user account.
        Overrides:
        doGuestLogon in class org.alfresco.jlan.server.auth.CifsAuthenticator
        Parameters:
        client - ClientInfo
        sess - SrvSession
      • getHomeFolderForUser

        protected final void getHomeFolderForUser​(org.alfresco.jlan.server.auth.ClientInfo client)
        Get the home folder for the user.
        Parameters:
        client - ClientInfo
      • mapUserNameToPerson

        public final java.lang.String mapUserNameToPerson​(java.lang.String userName,
                                                          boolean checkEnabled)
        Map the case insensitive logon name to the internal person object user name. And optionally check whether the user is enabled.
        Parameters:
        userName - String
        checkEnabled -
        Returns:
        the user name
      • setCurrentUser

        public void setCurrentUser​(org.alfresco.jlan.server.auth.ClientInfo client)
        Set the current authenticated user context for this thread.
        Specified by:
        setCurrentUser in interface org.alfresco.jlan.server.auth.ICifsAuthenticator
        Overrides:
        setCurrentUser in class org.alfresco.jlan.server.auth.CifsAuthenticator
        Parameters:
        client - ClientInfo or null to clear the context
      • getAuthenticationComponent

        protected final AuthenticationComponent getAuthenticationComponent()
        Return the authentication component.
        Returns:
        AuthenticationComponent
      • getNTLMAuthenticator

        protected final NLTMAuthenticator getNTLMAuthenticator()
        Returns an SSO-enabled authentication component.
        Returns:
        NLTMAuthenticator
      • getAuthenticationService

        protected final AuthenticationService getAuthenticationService()
        Return the authentication service.
        Returns:
        AuthenticationService
      • getNodeService

        protected final org.alfresco.service.cmr.repository.NodeService getNodeService()
        Return the node service.
        Returns:
        NodeService
      • getPersonService

        protected final PersonService getPersonService()
        Return the person service.
        Returns:
        PersonService
      • getAuthorityService

        protected final AuthorityService getAuthorityService()
        Return the authority service.
        Returns:
        AuthorityService
      • checkForAdminUserName

        protected final void checkForAdminUserName​(org.alfresco.jlan.server.auth.ClientInfo cInfo)
        Check if the user is an administrator user name.
        Parameters:
        cInfo - ClientInfo
      • doInTransaction

        protected <T> T doInTransaction​(RetryingTransactionHelper.RetryingTransactionCallback<T> callback)
        Does work in a transaction. This will be a writeable transaction unless the system is in read-only mode.
        Parameters:
        callback - a callback that does the work
        Returns:
        the result, or null if not applicable
      • destroy

        public void destroy()
                     throws java.lang.Exception
        Handle tidy up on container shutdown.
        Specified by:
        destroy in interface org.springframework.beans.factory.DisposableBean
        Throws:
        java.lang.Exception - the exception