Abstract Guidewire authentication servlet class

Important: Guidewire recommends that your servlets use HTTP basic authentication, which is supported by the gw.servlet.AbstractBasicAuthenticationServlet class.

To use the session key created from a Guidewire application that shares the same application context, you can write your servlet to extend the class gw.servlet.AbstractGWAuthServlet. You can use methods on the ServletUtils class to check the current authentication status of the session. You must override the following methods:

  • service – Your main task is to override the service method to do your required work. To check the HTTP request type, call the getMethod method on the servlet request object. PolicyCenter already authenticates the session key if it exists before calling your method.
  • authenticate – Create and return a session ID.
  • storeToken – You can store the session token in this method, or you can leave your method implementation empty.
  • invalidAuthentication – Return a response for invalid authentication. For example:
    override function invalidAuthentication( req: HttpServletRequest, 
            resp: HttpServletResponse ) : void {
      resp.setHeader( "WWW-Authenticate", "Basic realm=\"Secure Area\"")
      resp.setStatus( HttpServletResponse.SC_UNAUTHORIZED )
    }