com.mycompany.messages
Class AuthenticateAction

java.lang.Object
  extended bycom.mycompany.messages.AuthenticateAction

public class AuthenticateAction
extends java.lang.Object

This class performs authentication in the Project Billboard application.

Version:
1.0
Author:
Hans Bergsten, Gefion Software

Field Summary
private  EmployeeRegistryBean empReg
           
private  java.lang.String origURL
           
private  java.lang.String password
           
private  boolean remember
           
private  boolean rememberSet
           
private  java.lang.String username
           
 
Constructor Summary
AuthenticateAction()
           
 
Method Summary
 java.lang.String authenticate()
          Autheticates a user with help from the EmployeeRegistryBean.
 java.lang.String getOrigURL()
          Returns the originally requested URL, or null if none is set.
 java.lang.String getPassword()
          Returns the current password, or the value of a "password" cookie if no username is set.
 boolean getRemember()
          Returns the "remember" property value, or "true" if this property isn't set and a "password" cookie has a value.
 java.lang.String getUsername()
          Returns the current username, or the value of a "username" cookie if no username is set.
private  void setLoginCookies(javax.faces.context.FacesContext context, boolean remember, java.lang.String username, java.lang.String password)
          Set or "delete" the login cookies, depending on the value of the "remember" parameter.
 void setOrigURL(java.lang.String origURL)
          Sets the originally requested URL.
 void setPassword(java.lang.String password)
          Sets the password.
 void setRegistry(EmployeeRegistryBean empReg)
          Sets the registry holding user information.
 void setRemember(boolean remember)
          Sets the "remember" property value.
 void setUsername(java.lang.String username)
          Sets the username.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

username

private java.lang.String username

password

private java.lang.String password

remember

private boolean remember

rememberSet

private boolean rememberSet

empReg

private EmployeeRegistryBean empReg

origURL

private java.lang.String origURL
Constructor Detail

AuthenticateAction

public AuthenticateAction()
Method Detail

getUsername

public java.lang.String getUsername()
Returns the current username, or the value of a "username" cookie if no username is set.


setUsername

public void setUsername(java.lang.String username)
Sets the username.


getPassword

public java.lang.String getPassword()
Returns the current password, or the value of a "password" cookie if no username is set.


setPassword

public void setPassword(java.lang.String password)
Sets the password.


getRemember

public boolean getRemember()
Returns the "remember" property value, or "true" if this property isn't set and a "password" cookie has a value.


setRemember

public void setRemember(boolean remember)
Sets the "remember" property value.


setRegistry

public void setRegistry(EmployeeRegistryBean empReg)
Sets the registry holding user information.


getOrigURL

public java.lang.String getOrigURL()
Returns the originally requested URL, or null if none is set.


setOrigURL

public void setOrigURL(java.lang.String origURL)
Sets the originally requested URL.


authenticate

public java.lang.String authenticate()
Autheticates a user with help from the EmployeeRegistryBean. If the user can be authenticated, the "validUser" session attribute is set to an instance of the EmployeeBean, to serve as an authentication token in this application.

Cookies with the user name and password are set or reset as specified by the "remember" request parameter.


setLoginCookies

private void setLoginCookies(javax.faces.context.FacesContext context,
                             boolean remember,
                             java.lang.String username,
                             java.lang.String password)
Set or "delete" the login cookies, depending on the value of the "remember" parameter.