|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.GenericServlet javax.servlet.http.HttpServlet com.ibm.as400.util.servlet.AuthenticationServlet
public class AuthenticationServlet extends javax.servlet.http.HttpServlet
AuthenticationServlet is an HttpServlet implementation that performs basic authentication for servlets. Subclasses should override the validateAuthority() method to perform the authentication. The bypassValidation() method can be overridden to authenticate only certain requests and the postValidation() method can be overridden for additional processing of the request after authenticating.
Constructor and Description |
---|
AuthenticationServlet()
Constructs a default AuthenticationServlet object. |
AuthenticationServlet(String user,
String password,
String realm)
Constructs an AuthenticationServlet object with the specified user, password, and realm. |
Modifier and Type | Method and Description |
---|---|
boolean |
bypassAuthentication(javax.servlet.http.HttpServletRequest req)
Method to check to see if authentication should be performed. |
Log |
getLog()
Get the log object used for tracing and error logging. |
String |
getRealm()
Retrieve the realm that was used for the authentication. |
String |
getUser()
Retrieve the user that was used for the authentication. |
void |
init(javax.servlet.ServletConfig config)
Servlet initialization. |
void |
log(Exception e,
String msg)
Log an exception and message to the event log. |
void |
log(String msg)
Log a message to the event log. |
boolean |
postValidation(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Method called after validation has occured. |
void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override the default service() method for HttpServlet. |
void |
setLog(Log log)
Set the log object used for tracing and error logging. |
void |
setPassword(String password)
Set the password. |
void |
setRealm(String realm)
Set the realm that will be used for the authentication. |
void |
setUser(String user)
Set the user ID. |
boolean |
validateAuthority(String realm,
String uid,
String pw)
Method used to validate. |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doGet, doOptions, doPost, doPut, doTrace, getLastModified, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, init, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AuthenticationServlet()
public AuthenticationServlet(String user, String password, String realm)
user
- The user ID to use.password
- The password for this user ID.realm
- The realm, which refers to the system name.Method Detail |
---|
public boolean bypassAuthentication(javax.servlet.http.HttpServletRequest req)
req
- The HttpServletRequest object for this request.public Log getLog()
public String getUser()
public String getRealm()
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
config
- The servlet configuration.javax.servlet.ServletException
- A ServletException is thrown if a problem with the servlet occurs.public void log(String msg)
log
in class javax.servlet.GenericServlet
msg
- The message to log.public void log(Exception e, String msg)
e
- The exception to log.msg
- The message to log.public void setLog(Log log)
log
- The Log.public void setPassword(String password)
password
- The password to use.public void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException
service
in class javax.servlet.http.HttpServlet
req
- The HTTP servlet request.resp
- The HTTP servlet response.javax.servlet.ServletException
- A ServletException is thrown if a problem with the servlet occurs.IOException
- An IOException is thrown if a communications error occurs.public void setRealm(String realm)
realm
- The realm, which refers to the system name.public void setUser(String user)
user
- The user ID to use.public boolean validateAuthority(String realm, String uid, String pw) throws SecurityException, IOException
realm
- The realm to validate against.uid
- The user ID to use for validation.pw
- The password to use for validation.SecurityException
- This exception should be thrown if validation fails.IOException
- This exception should be thrown if a communication error occurs during validation.public boolean postValidation(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException
req
- The HTTP servlet request.resp
- The HTTP servlet response.javax.servlet.ServletException
- A ServletException is thrown if a problem with the servlet occurs.IOException
- An IOException is thrown if a communications error occurs.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |