public class AuthenticationServlet
extends javax.servlet.http.HttpServlet
Constructor and Description |
---|
AuthenticationServlet()
Constructs a default AuthenticationServlet object.
|
AuthenticationServlet(java.lang.String user,
java.lang.String password,
java.lang.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.
|
java.lang.String |
getRealm()
Retrieve the realm that was used for the authentication.
|
java.lang.String |
getUser()
Retrieve the user that was used for the authentication.
|
void |
init(javax.servlet.ServletConfig config)
Servlet initialization.
|
void |
log(java.lang.Exception e,
java.lang.String msg)
Log an exception and message to the event log.
|
void |
log(java.lang.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(java.lang.String password)
Set the password.
|
void |
setRealm(java.lang.String realm)
Set the realm that will be used for the authentication.
|
void |
setUser(java.lang.String user)
Set the user ID.
|
boolean |
validateAuthority(java.lang.String realm,
java.lang.String uid,
java.lang.String pw)
Method used to validate.
|
doDelete, doGet, doOptions, doPost, doPut, doTrace, getLastModified, service
public AuthenticationServlet()
public AuthenticationServlet(java.lang.String user, java.lang.String password, java.lang.String realm)
user
- The user ID to use.password
- The password for this user ID.realm
- The realm, which refers to the system name.public boolean bypassAuthentication(javax.servlet.http.HttpServletRequest req)
req
- The HttpServletRequest object for this request.public Log getLog()
public java.lang.String getUser()
public java.lang.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(java.lang.String msg)
log
in class javax.servlet.GenericServlet
msg
- The message to log.public void log(java.lang.Exception e, java.lang.String msg)
e
- The exception to log.msg
- The message to log.public void setLog(Log log)
log
- The Log.public void setPassword(java.lang.String password)
password
- The password to use.public void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.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.java.io.IOException
- An IOException is thrown if a communications error occurs.public void setRealm(java.lang.String realm)
realm
- The realm, which refers to the system name.public void setUser(java.lang.String user)
user
- The user ID to use.public boolean validateAuthority(java.lang.String realm, java.lang.String uid, java.lang.String pw) throws java.lang.SecurityException, java.io.IOException
realm
- The realm to validate against.uid
- The user ID to use for validation.pw
- The password to use for validation.java.lang.SecurityException
- This exception should be thrown if validation fails.java.io.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, java.io.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.java.io.IOException
- An IOException is thrown if a communications error occurs.