org.nst.pasientlink.authenticator.admin
Class Controller
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--org.apache.velocity.servlet.VelocityServlet
|
+--org.nst.pasientlink.authenticator.admin.Controller
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class Controller
- extends org.apache.velocity.servlet.VelocityServlet
- See Also:
- Serialized Form
Fields inherited from class org.apache.velocity.servlet.VelocityServlet |
CONTENT_TYPE, DEFAULT_CONTENT_TYPE, DEFAULT_OUTPUT_ENCODING, defaultContentType, encoding, INIT_PROPS_KEY, REQUEST, RESPONSE, writerPool |
Fields inherited from class javax.servlet.http.HttpServlet |
HEADER_IFMODSINCE, HEADER_LASTMOD, LSTRING_FILE, lStrings, METHOD_DELETE, METHOD_GET, METHOD_HEAD, METHOD_OPTIONS, METHOD_POST, METHOD_PUT, METHOD_TRACE |
Fields inherited from class javax.servlet.GenericServlet |
config |
Method Summary |
int |
authenticateSession(java.lang.String mySingleUsePassword,
Request myRequest)
|
protected void |
error(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Exception cause)
Override the method from VelocityServlet to produce an intelligent
message to the browser |
private java.lang.String |
getAdminGSMSubscriberID()
getAdminGSMSubscriberID returns the administrator GSM subscriber ID, as loaded
from the configuration file |
private byte[] |
getAdminPasswordHash()
getAdminPasswordHash returns the administrator password hash, as constructed
from the configuration file |
private java.lang.String |
getAdminUsername()
getAdminUsername returns the administrator username, as it has been
loaded from the configuration file |
static AuthenticatorStorage |
getAuthenticatorStorage()
getAuthenticatorStorage returns the authenticatorstorage |
static PronouncablePassword |
getPasswordGenerator()
getPasswordGenerator returns the password generator, and is used
from the UserCreateCommand chiefly |
static Utility |
getUtility()
getUtility returns the utility instance |
org.apache.velocity.Template |
handleRequest(org.apache.velocity.context.Context ctx)
handleRequest processes all requests and directs them to the correct template.
|
protected java.util.Properties |
loadConfiguration(javax.servlet.ServletConfig config)
loadConfiguration sets up Velocity & the logger |
private java.lang.String |
processRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.apache.velocity.context.Context context)
Process the request and execute the command.
|
Request |
requestAuthentication(java.lang.String myUsername,
java.lang.String myPassword)
requestAuthentication verifies that admin username and password
matches. |
Methods inherited from class org.apache.velocity.servlet.VelocityServlet |
, createContext, doGet, doPost, doRequest, getTemplate, getTemplate, handleRequest, init, initVelocity, mergeTemplate, requestCleanup, setContentType |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getAllDeclaredMethods, getLastModified, maybeSetLastModified, 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, registerNatives, toString, wait, wait, wait |
AUTHENTICATOR_LOGGER_INSTANCe
private static final java.lang.String AUTHENTICATOR_LOGGER_INSTANCe
COMMAND_REQUEST_AUTHENTICATION
public static final java.lang.String COMMAND_REQUEST_AUTHENTICATION
COMMAND_AUTHENTICATE_SESSION
public static final java.lang.String COMMAND_AUTHENTICATE_SESSION
AUTHENTICATION_REQUEST
public static final java.lang.String AUTHENTICATION_REQUEST
SESSION_AUTHENTICATED
public static final java.lang.String SESSION_AUTHENTICATED
COMMAND_USER_CREATE
public static final java.lang.String COMMAND_USER_CREATE
COMMAND_USER_DELETE
public static final java.lang.String COMMAND_USER_DELETE
COMMAND_USER_EDIT
public static final java.lang.String COMMAND_USER_EDIT
COMMAND_LOGOUT
public static final java.lang.String COMMAND_LOGOUT
ERR_MSG_TAG
private static java.lang.String ERR_MSG_TAG
REQUEST_AUTHENTICATION_WRONG_USERNAME_OR_PASSWORD
public static final java.lang.String REQUEST_AUTHENTICATION_WRONG_USERNAME_OR_PASSWORD
AUTHENTICATE_SESSION_OK
public static final java.lang.String AUTHENTICATE_SESSION_OK
AUTHENTICATE_SESSION_TIMED_OUT
public static final java.lang.String AUTHENTICATE_SESSION_TIMED_OUT
AUTHENTICATE_SESSION_UNKNOWN_ERROR
public static final java.lang.String AUTHENTICATE_SESSION_UNKNOWN_ERROR
PASSWORD_GENERATOR
public static final java.lang.String PASSWORD_GENERATOR
passwordGenerator
private static PronouncablePassword passwordGenerator
myStore
private static AuthenticatorStorage myStore
myUtility
private static Utility myUtility
logger
private org.apache.log4j.Logger logger
adminPasswordHash
private byte[] adminPasswordHash
adminUsername
private java.lang.String adminUsername
adminGSMSubscriberID
private java.lang.String adminGSMSubscriberID
Controller
public Controller()
loadConfiguration
protected java.util.Properties loadConfiguration(javax.servlet.ServletConfig config)
throws java.io.IOException,
java.io.FileNotFoundException
- loadConfiguration sets up Velocity & the logger
- Overrides:
loadConfiguration
in class org.apache.velocity.servlet.VelocityServlet
- Parameters:
config
- ServletConfig- Returns:
- Properties containing configuration properties loaded from file
handleRequest
public org.apache.velocity.Template handleRequest(org.apache.velocity.context.Context ctx)
- handleRequest processes all requests and directs them to the correct template.
Also, this method verifies that request is processed within a valid, authenticated
session. If the user session has not been authenticated (or is in the process of
performing authentication), the request will be direted to the auth. pages.
- Overrides:
handleRequest
in class org.apache.velocity.servlet.VelocityServlet
- Parameters:
the
- Context created in VelocityServlet.- Returns:
- the template
processRequest
private java.lang.String processRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.apache.velocity.context.Context context)
throws java.lang.Exception
- Process the request and execute the command.
Uses a command pattern
- Parameters:
the
- requestthe
- responsethe
- context- Returns:
- the name of the template to use
error
protected void error(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Exception cause)
throws javax.servlet.ServletException,
java.io.IOException
- Override the method from VelocityServlet to produce an intelligent
message to the browser
- Overrides:
error
in class org.apache.velocity.servlet.VelocityServlet
getPasswordGenerator
public static PronouncablePassword getPasswordGenerator()
- getPasswordGenerator returns the password generator, and is used
from the UserCreateCommand chiefly
requestAuthentication
public Request requestAuthentication(java.lang.String myUsername,
java.lang.String myPassword)
- requestAuthentication verifies that admin username and password
matches. If they do, a request is generated and returned.
- Parameters:
myUsername
- String containing admin user namemyPassword
- String containing admin password- Returns:
- Request or null if request for authentication failed
authenticateSession
public int authenticateSession(java.lang.String mySingleUsePassword,
Request myRequest)
getAdminUsername
private java.lang.String getAdminUsername()
- getAdminUsername returns the administrator username, as it has been
loaded from the configuration file
- Returns:
- String containing admin username, or null if it has not been loaded yet
getAdminPasswordHash
private byte[] getAdminPasswordHash()
- getAdminPasswordHash returns the administrator password hash, as constructed
from the configuration file
- Returns:
- byte[] containing admin password hash, or null if this cannot be
instantiated from file
getAuthenticatorStorage
public static AuthenticatorStorage getAuthenticatorStorage()
- getAuthenticatorStorage returns the authenticatorstorage
- Returns:
- AuthenticatorStorage
getUtility
public static Utility getUtility()
- getUtility returns the utility instance
getAdminGSMSubscriberID
private java.lang.String getAdminGSMSubscriberID()
- getAdminGSMSubscriberID returns the administrator GSM subscriber ID, as loaded
from the configuration file
- Returns:
- String containing admin GSM subscriber ID, or null if this was not loaded from configuration
Copyright © 2002 Norwegian Centre for Telemedicine. All Rights Reserved.