Test your servlet using multiple authentication types
You can use a servlet that uses either basic or Guidewire authentication to log in to PolicyCenter. Test this type of servlet by following this procedure.
Before you begin
mycompany.test.TestingServlet
servlet, as shown in Example of a servlet using multiple authentication types.Procedure
- Register this servlet in servlets.xml.
-
Run the QuickStart server at the
command prompt:
gwb runServerDo not log in to the PolicyCenter application.
-
Test the servlet with no authentication by going to the URL:
http://localhost:8180/pc/service/testYou see a message:
HTTP ERROR 401 Problem accessing /pc/service/test. Reason: Unauthorized. No valid user with session context or HTTP Basic. - Log in to the PolicyCenter application with valid credentials.
-
Test the servlet with the PolicyCenter authenticated
user by going to the URL:
http://localhost:8180/pc/service/testYou see a message:
REQUEST SUCCEEDED req.RequestURI: '/pc/service/test' req.PathInfo: '/test' req.RequestURL: 'http://localhost:8180/pc/service/test' authenticated user name: 'Super User' -
To test the HTTP basic authentication:
- Sign out of the PolicyCenter application to remove the session context.
- Re-test your servlet, using a tool that supports adding HTTP headers for HTTP basic authentication.
