com.tivoli.am.eb.web.eaidemo
Class AbstractEAIDemoServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.tivoli.am.eb.web.eaidemo.AbstractEAIDemoServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
AdvancedEAIDemoServlet, SimpleEAIDemoServlet

public abstract class AbstractEAIDemoServlet
extends javax.servlet.http.HttpServlet

An abstract servlet that performs EAI operations common to both the user ID and PAC operations.

Author:
Tivoli Systems
See Also:
Serialized Form

Field Summary
protected  EAIDemoServerConfig config
           
static java.lang.String ORIG_USER_ATTR_NAME
          The name of the header used to communicate the user id entered in the login form.
 
Constructor Summary
AbstractEAIDemoServlet()
           
 
Method Summary
protected abstract  java.lang.Object doAuthentication(javax.servlet.http.HttpServletRequest req)
          Finds the authentication data in the client's request and converts it to a principal appropriate to the type of EAI operation (user ID or PAC).
protected abstract  void doEAIHeaders(java.lang.Object principal, javax.servlet.http.HttpServletResponse resp)
          Sets the appropriate headers and respective values based on the configuration of the servlet and EAI type (user ID or PAC).
 void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Responds to a POST operation by adding the EAI headers and printing a simple message to the user.
 java.lang.String getDeclaredAuthLevel()
          Returns the authentication level the user declared in the login page.
 java.lang.String getDeclaredTamUser()
          Returns the user name that was inputted in the login page.
 java.lang.String getRequestedUrl()
          Returns the url that was initially requested.
 void init()
          Sets up common servlet configuration.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORIG_USER_ATTR_NAME

public static final java.lang.String ORIG_USER_ATTR_NAME
The name of the header used to communicate the user id entered in the login form.

See Also:
Constant Field Values

config

protected EAIDemoServerConfig config
Constructor Detail

AbstractEAIDemoServlet

public AbstractEAIDemoServlet()
Method Detail

getDeclaredAuthLevel

public java.lang.String getDeclaredAuthLevel()
Returns the authentication level the user declared in the login page.

Returns:
the auth level as a string, null if it wasn't submitted.

getDeclaredTamUser

public java.lang.String getDeclaredTamUser()
Returns the user name that was inputted in the login page.

Returns:
the user name as a string, null if it wasn't submitted.

getRequestedUrl

public java.lang.String getRequestedUrl()
Returns the url that was initially requested. This will only work if the url was sent in a local response redirect request.

Returns:
the url of the initial request, null if not available.

doPost

public void doPost(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse resp)
            throws javax.servlet.ServletException,
                   java.io.IOException
Responds to a POST operation by adding the EAI headers and printing a simple message to the user. The message will not be seen unless WebSEAL is misconfigured (WebSEAL will either redirect the client to another page or display its own login success page).

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
req - The HTTP request object
resp - The HTTP response object
Throws:
javax.servlet.ServletException - if the servlet cannot process the request
java.io.IOException - if the servlet encounters a problem writing to the client

init

public void init()
          throws javax.servlet.ServletException
Sets up common servlet configuration.

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException - if an error occured which causes the servlet to initialize incorrectly.

doAuthentication

protected abstract java.lang.Object doAuthentication(javax.servlet.http.HttpServletRequest req)
                                              throws java.lang.Exception
Finds the authentication data in the client's request and converts it to a principal appropriate to the type of EAI operation (user ID or PAC).

Parameters:
req - The HTTP request from the client.
Returns:
A principal for inclusion in the HTTP headers of the response. The object returned from this method will be passed into doEAIHeaders().
Throws:
java.lang.Exception

doEAIHeaders

protected abstract void doEAIHeaders(java.lang.Object principal,
                                     javax.servlet.http.HttpServletResponse resp)
Sets the appropriate headers and respective values based on the configuration of the servlet and EAI type (user ID or PAC). The header names returned can be configured by editing the servlet context parameters found in the file WEB-INF/web.xml.

Parameters:
principal - The object returned from doAuthentication(). It is assumed that the developer knows the data type and can cast down appropriately.
resp - The HTTP response where the headers will be sent.


Copyright © 2004 IBM Corp. All Rights Reserved.