com.zeevbelkin.web.filter.access
Class SavedLoginHandler

java.lang.Object
  extended by com.zeevbelkin.web.filter.access.SavedLoginHandler

public abstract class SavedLoginHandler
extends java.lang.Object

This class is intended to be used as a base class of saved login handlers. The filter customer, that wants to use saved login abilities, should derive a class from this one, and then inform the filter about the derived class name with web.ini file savedLoginHandler parameter.

      <filter>
         <filter-name>Yaacfi</filter-name>
         <filter-class>com.zeevbelkin.web.filter.access.Yaaf</filter-class>
         <init-param>
             <param-name>access-restrictions</param-name>
             <param-value>access-restrictions.xml</param-value>
         </init-param>
         <init-param>
             <param-name>login-handler</param-name>
             <param-value>/pages/login.jsp</param-value>
         </init-param>
         <init-param>
             <param-name>savedLoginHandler</param-name>
             <param-value>com.myapp.TheSavedLoginHandler</param-value>
         </init-param>
     </filter>
 
The derived class must implement, at least, assignCredentials, store and drop methods. If the saved login handler class has a constructor that accepts ServletContext parameter, this parameter will be passed while the instantiation

Author:
Zeev (Vladimir) Belkin

Constructor Summary
SavedLoginHandler()
           
 
Method Summary
abstract  void assignCredentials(java.lang.String saved_login, Yaaf.SessionSecurityInfo ssi)
          This method tries to find a user credentials using the stored login info, and, in case of success assigns the user credentials.
 java.lang.String createSavedLogin(java.lang.String user_id)
          Creates stored login info for a given user name.
abstract  void drop(java.lang.String user_id)
          This method is intended to remove the saved login info from the database.
 java.lang.String getCookieName()
          The default value, returned by this method is "yaacfy_savedLogin";
abstract  void store(java.lang.String user_id, java.lang.String savedLogin)
          This method is intended to save the login for the given user name and saved login string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SavedLoginHandler

public SavedLoginHandler()
Method Detail

getCookieName

public java.lang.String getCookieName()
The default value, returned by this method is "yaacfy_savedLogin";

Returns:
name of cookie user to keep stored login info

createSavedLogin

public java.lang.String createSavedLogin(java.lang.String user_id)
Creates stored login info for a given user name. The default implementation returns a random UUID.

Parameters:
user_id - user name to create stored the login info for

assignCredentials

public abstract void assignCredentials(java.lang.String saved_login,
                                       Yaaf.SessionSecurityInfo ssi)
This method tries to find a user credentials using the stored login info, and, in case of success assigns the user credentials. Ordinary the stored login info is used as a key for a database lookup. The filter customer must override this method.

Parameters:
saved_login - Saved login string retrieved from a cookie
ssi - Session Security Info to assign the credentials in case of success

store

public abstract void store(java.lang.String user_id,
                           java.lang.String savedLogin)
This method is intended to save the login for the given user name and saved login string. Ordinary this method implementation inserts to a database table a pair where the saved login string is a key and the user name is a value. The filter customer must override this method if he/she uses the saved login abilities.

Parameters:
user_id - the user name for the login serialization process
savedLogin - the saved login string

drop

public abstract void drop(java.lang.String user_id)
This method is intended to remove the saved login info from the database. The filer customer must override this method if he/she uses the saved login abilities.

Parameters:
the - user name to drop the saved login info