Class AdminAuthenticationService


  • public final class AdminAuthenticationService
    extends java.lang.Object
    This class provides a security service to register and check user authentication
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAuthServiceName()  
      java.lang.String getChangePasswordPageUrl()
      Returns the modification password page URL of the Authentication Service
      java.lang.String getDoLoginUrl()
      Returns the DoLogin URL of the Authentication Service
      java.lang.String getDoLogoutUrl()
      Returns the DoLogout URL of the Authentication Service
      static AdminAuthenticationService getInstance()
      Get the unique instance of the Security Service
      java.lang.String getLoginNextUrl​(javax.servlet.http.HttpServletRequest request)
      Returns the url (asked before login) to redirect after login
      java.lang.String getLoginPageUrl()
      Returns the Login page URL of the Authentication Service
      java.lang.String getLostLoginPageUrl()
      Returns the lost login URL of the Authentication Service
      java.lang.String getLostPasswordPageUrl()
      Returns the lost password URL of the Authentication Service
      java.lang.String getNewAccountPageUrl()
      Returns the new account page URL of the Authentication Service
      AdminUser getRegisteredUser​(javax.servlet.http.HttpServletRequest request)
      Gets the Lutece user registered in the Http session
      AdminUser getRemoteUser​(javax.servlet.http.HttpServletRequest request)
      Gets the AdminUser attached to the current Http session
      java.util.Collection<AdminUser> getUserListFromModule​(java.lang.String strLastName, java.lang.String strFirstName, java.lang.String strEmail)
      Returns the user list
      AdminUser getUserPublicDataFromModule​(java.lang.String strAccessCode)  
      java.lang.String getViewAccountPageUrl()
      Returns the view account page URL of the Authentication Service
      static void init()
      Initialize service
      boolean isDefaultModuleUsed()
      Check whether the authentication service is configurer on the default module.
      boolean isExternalAuthentication()
      Returns the authentication type : External or Lutece portal based
      void loginUser​(javax.servlet.http.HttpServletRequest request, java.lang.String strAccessCode, java.lang.String strPassword)
      Checks user's login with the Authentication service.
      void logoutUser​(javax.servlet.http.HttpServletRequest request)
      Logout the user
      <T extends AdminUser>
      void
      registerUser​(javax.servlet.http.HttpServletRequest request, T user)
      Register the user in the Http session
      void setLoginNextUrl​(javax.servlet.http.HttpServletRequest request)
      Set the admin login next url
      void unregisterUser​(javax.servlet.http.HttpServletRequest request)
      Unregister the user in the Http session
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • init

        public static void init()
        Initialize service
      • getInstance

        public static AdminAuthenticationService getInstance()
        Get the unique instance of the Security Service
        Returns:
        The instance
      • isDefaultModuleUsed

        public boolean isDefaultModuleUsed()
        Check whether the authentication service is configurer on the default module.
        Returns:
        true if the default module is in use, false if another module is used
      • loginUser

        public void loginUser​(javax.servlet.http.HttpServletRequest request,
                              java.lang.String strAccessCode,
                              java.lang.String strPassword)
                       throws javax.security.auth.login.LoginException
        Checks user's login with the Authentication service.
        Parameters:
        request - The Http request
        strAccessCode - The user's login
        strPassword - The user's password
        Throws:
        javax.security.auth.login.LoginException - The LoginException
      • logoutUser

        public void logoutUser​(javax.servlet.http.HttpServletRequest request)
        Logout the user
        Parameters:
        request - The HTTP request
      • unregisterUser

        public void unregisterUser​(javax.servlet.http.HttpServletRequest request)
        Unregister the user in the Http session
        Parameters:
        request - The Http request
      • getRegisteredUser

        public AdminUser getRegisteredUser​(javax.servlet.http.HttpServletRequest request)
        Gets the Lutece user registered in the Http session
        Parameters:
        request - The HTTP request
        Returns:
        The User registered or null if the user has not been registered
      • isExternalAuthentication

        public boolean isExternalAuthentication()
        Returns the authentication type : External or Lutece portal based
        Returns:
        true if the user is already authenticated or false if it needs to login.
      • getLoginPageUrl

        public java.lang.String getLoginPageUrl()
        Returns the Login page URL of the Authentication Service
        Returns:
        The URL
      • getChangePasswordPageUrl

        public java.lang.String getChangePasswordPageUrl()
        Returns the modification password page URL of the Authentication Service
        Returns:
        The URL
      • getDoLoginUrl

        public java.lang.String getDoLoginUrl()
        Returns the DoLogin URL of the Authentication Service
        Returns:
        The URL
      • getDoLogoutUrl

        public java.lang.String getDoLogoutUrl()
        Returns the DoLogout URL of the Authentication Service
        Returns:
        The URL
      • getNewAccountPageUrl

        public java.lang.String getNewAccountPageUrl()
        Returns the new account page URL of the Authentication Service
        Returns:
        The URL
      • getViewAccountPageUrl

        public java.lang.String getViewAccountPageUrl()
        Returns the view account page URL of the Authentication Service
        Returns:
        The URL
      • getLostPasswordPageUrl

        public java.lang.String getLostPasswordPageUrl()
        Returns the lost password URL of the Authentication Service
        Returns:
        The URL
      • getLostLoginPageUrl

        public java.lang.String getLostLoginPageUrl()
        Returns the lost login URL of the Authentication Service
        Returns:
        The URL
      • getUserListFromModule

        public java.util.Collection<AdminUser> getUserListFromModule​(java.lang.String strLastName,
                                                                     java.lang.String strFirstName,
                                                                     java.lang.String strEmail)
        Returns the user list
        Parameters:
        strLastName - The last name
        strFirstName - The first name
        strEmail - The email
        Returns:
        the collection of all users from the module
      • getUserPublicDataFromModule

        public AdminUser getUserPublicDataFromModule​(java.lang.String strAccessCode)
        Parameters:
        strAccessCode - The login
        Returns:
        The AdminUser
      • setLoginNextUrl

        public void setLoginNextUrl​(javax.servlet.http.HttpServletRequest request)
        Set the admin login next url
        Parameters:
        request - the HTTP request
      • getLoginNextUrl

        public java.lang.String getLoginNextUrl​(javax.servlet.http.HttpServletRequest request)
        Returns the url (asked before login) to redirect after login
        Parameters:
        request - The Http request
        Returns:
        The url asked before login
      • getAuthServiceName

        public java.lang.String getAuthServiceName()
        Returns:
        the name of the authentication module load