Class AbstractAuthenticationServlet

  • All Implemented Interfaces:
    edu.uiuc.ncsa.security.core.Logable, edu.uiuc.ncsa.security.servlet.Presentable, Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, TransactionFilter
    Direct Known Subclasses:
    OA2AuthenticationServer

    public abstract class AbstractAuthenticationServlet
    extends OA4MPServlet
    implements edu.uiuc.ncsa.security.servlet.Presentable

    Created by Jeff Gaynor
    on 1/14/14 at 11:50 AM

    See Also:
    Serialized Form
    • Constructor Detail

      • AbstractAuthenticationServlet

        public AbstractAuthenticationServlet()
    • Method Detail

      • createCallback

        public abstract String createCallback​(ServiceTransaction transaction,
                                              Map<String,​String> params)
        This will take whatever the passed in callback from the client is and append any parameters needed. Generally these parameters are protocol specific.
        Parameters:
        transaction -
        Returns:
      • prepare

        public void prepare​(edu.uiuc.ncsa.security.servlet.PresentableState state)
                     throws Throwable
        Specified by:
        prepare in interface edu.uiuc.ncsa.security.servlet.Presentable
        Throws:
        Throwable
      • getInitialPage

        protected String getInitialPage()
      • getRemoteUserInitialPage

        protected String getRemoteUserInitialPage()
      • getOkPage

        protected String getOkPage()
      • present

        public void present​(edu.uiuc.ncsa.security.servlet.PresentableState state)
                     throws Throwable
        Specified by:
        present in interface edu.uiuc.ncsa.security.servlet.Presentable
        Throws:
        Throwable
      • handleError

        public void handleError​(edu.uiuc.ncsa.security.servlet.PresentableState state,
                                Throwable t)
                         throws IOException,
                                javax.servlet.ServletException
        Specified by:
        handleError in interface edu.uiuc.ncsa.security.servlet.Presentable
        Throws:
        IOException
        javax.servlet.ServletException
      • getParam

        protected String getParam​(javax.servlet.http.HttpServletRequest request,
                                  String key)
      • doIt

        protected void doIt​(javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
                     throws Throwable
        Specified by:
        doIt in class edu.uiuc.ncsa.security.servlet.AbstractServlet
        Throws:
        Throwable
      • getState

        public static int getState​(javax.servlet.http.HttpServletRequest request)
        Basically a switch statement for the auth actions, but with the special case that no action means AUTHORIZATION_ACTION_START, since that is an initial request with no state.
        Parameters:
        request -
        Returns:
      • createRedirect

        protected void createRedirect​(javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response,
                                      ServiceTransaction trans)
                               throws Throwable
        Throws:
        Throwable
      • createRedirectInit

        protected abstract void createRedirectInit​(ServiceTransaction trans,
                                                   String userName,
                                                   String password)
        Additional setup for the callback. This is aimed at MyProxy aware services.
        Parameters:
        trans -
        userName -
        password -
      • checkUser

        public void checkUser​(String username,
                              String password)
                       throws GeneralSecurityException
        If OA4MP has been extended to have a native concept of a user, this is the method that is used to verify them. Normally this is only called if explicitly set and no other authorization method (such as a proxy) is configured. Therefore, the default behavior is to throw an exception, but this is where the logic has to be. To add a user, extend OA2AuthorizationServer, override this method to talk to whatever manages your users and set your servlet as the authorization endpoint.
        Parameters:
        username -
        password -
        Throws:
        GeneralSecurityException