Class LoginAdmin

java.lang.Object
edu.ucsb.nceas.metacat.admin.MetacatAdmin
edu.ucsb.nceas.metacat.admin.LoginAdmin

public class LoginAdmin extends MetacatAdmin
Control the display of the login page
  • Field Summary

    Fields inherited from class edu.ucsb.nceas.metacat.admin.MetacatAdmin

    COMPLETE, FAILURE, IN_PROGRESS, NOT_REQUIRED, PENDING, SUCCESS, UNKNOWN
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doMetacatLogin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Use the ORCID auth token to log the admin user in
    static LoginAdmin
    Get the single instance of LoginAdmin.
    protected void
    handle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Handle all login-related cases: 1.
    protected void
    handleOrcidRedirect(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Handle the case where the User has authenticated via ORCID and the orcid site has redirected the user here.
    protected void
    logOutAdminUser(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Put user in a logged-out state by removing userId from session, and invalidating session.
    boolean
    needsLoginAdminHandling(javax.servlet.http.HttpServletRequest request, String action)
    Utility method to determine if an incoming request action requires intervention by this class
    protected void
    startLoginFlow(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Begin the login flow
    protected Vector<String>
    validateOptions(javax.servlet.http.HttpServletRequest request)
    Required override from superclass.

    Methods inherited from class edu.ucsb.nceas.metacat.admin.MetacatAdmin

    updateUpgradeStatus

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getInstance

      public static LoginAdmin getInstance()
      Get the single instance of LoginAdmin.
      Returns:
      the single instance of LoginAdmin
    • needsLoginAdminHandling

      public boolean needsLoginAdminHandling(javax.servlet.http.HttpServletRequest request, String action) throws MetacatUtilException
      Utility method to determine if an incoming request action requires intervention by this class
      Parameters:
      request - The http request information
      action - The `action` contained in the `MetacatAdminServlet.ACTION_PARAM` parameter of the request
      Returns:
      boolean true if intervention is needed by this class; false otherwise
      Throws:
      MetacatUtilException
    • handle

      protected void handle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws MetacatUtilException, AdminException
      Handle all login-related cases: 1. the user is not yet logged in, and has not started the orcid flow 2. the user is not yet logged in, but is part-way through the orcid flow 3. the user wishes to log out
      Parameters:
      request - The http request information
      response - The http response to be sent back to the client
      Throws:
      MetacatUtilException
      AdminException
    • startLoginFlow

      protected void startLoginFlow(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws AdminException
      Begin the login flow
      Parameters:
      request - The http request information
      response - The http response to be sent back to the client
      Throws:
      AdminException - if unable to forward request
    • handleOrcidRedirect

      protected void handleOrcidRedirect(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws AdminException
      Handle the case where the User has authenticated via ORCID and the orcid site has redirected the user here. User does not yet have the token.
      Parameters:
      request - The http request information
      response - The http response to be sent back to the client
      Throws:
      AdminException - if unable to forward request
    • doMetacatLogin

      protected void doMetacatLogin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws AdminException
      Use the ORCID auth token to log the admin user in
      Parameters:
      request - The http request information, including the jwt token in the 'Authorization' header
      response - The http response to be sent back to the client
      Throws:
      AdminException - if unable to forward request
    • logOutAdminUser

      protected void logOutAdminUser(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws AdminException
      Put user in a logged-out state by removing userId from session, and invalidating session. Then return to login page
      Parameters:
      request - The http request information
      response - The http response to be sent back to the client
      Throws:
      AdminException - if unable to forward request
    • validateOptions

      protected Vector<String> validateOptions(javax.servlet.http.HttpServletRequest request)
      Required override from superclass. Validate the relevant configuration options submitted by the user. There are no options to validate at this time as the user is not submitting a form. Only ORCID authentication is available.
      Specified by:
      validateOptions in class MetacatAdmin
      Returns:
      A vector holding error messages for any fields that fail validation.