com.uwyn.rife.authentication.remembermanagers
Class PurgingRememberManager

java.lang.Object
  extended by com.uwyn.rife.authentication.remembermanagers.PurgingRememberManager
All Implemented Interfaces:
RememberManager

public class PurgingRememberManager
extends Object
implements RememberManager


Constructor Summary
PurgingRememberManager(RememberManager rememberManager)
           
 
Method Summary
 String createRememberId(long userId, String hostIp)
          Starts a new session.
 void eraseAllRememberIds()
          Removes all available remember ID.
 boolean eraseRememberId(String rememberId)
          Removes one particular remember ID.
 boolean eraseUserRememberIds(long userId)
          Removes all remember IDs for a particular user.
 long getRememberDuration()
          Obtains the maximum time that a remember ID can be used before it becomes invalid.
 long getRememberedUserId(String rememberId)
          Retrieves the user ID that corresponds to a certain remember ID.
 RememberManager getRememberManager()
           
 int getRememberPurgeFrequency()
           
 int getRememberPurgeScale()
           
 void purgeRememberIds()
          Removes all remember IDs that are expired.
 void setRememberDuration(long milliseconds)
          Sets the maximum time that a remember ID can be used before it becomes invalid.
 void setRememberPurgeFrequency(int frequency)
           
 void setRememberPurgeScale(int scale)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PurgingRememberManager

public PurgingRememberManager(RememberManager rememberManager)
Method Detail

getRememberManager

public RememberManager getRememberManager()

getRememberPurgeFrequency

public int getRememberPurgeFrequency()

setRememberPurgeFrequency

public void setRememberPurgeFrequency(int frequency)

getRememberPurgeScale

public int getRememberPurgeScale()

setRememberPurgeScale

public void setRememberPurgeScale(int scale)

getRememberDuration

public long getRememberDuration()
Description copied from interface: RememberManager
Obtains the maximum time that a remember ID can be used before it becomes invalid.

Specified by:
getRememberDuration in interface RememberManager
Returns:
The maximum lifetime in milliseconds.

setRememberDuration

public void setRememberDuration(long milliseconds)
Description copied from interface: RememberManager
Sets the maximum time that a remember ID can be used before it becomes invalid.

Specified by:
setRememberDuration in interface RememberManager
Parameters:
milliseconds - The lifetime in milliseconds.

createRememberId

public String createRememberId(long userId,
                               String hostIp)
                        throws RememberManagerException
Description copied from interface: RememberManager
Starts a new session.

Specified by:
createRememberId in interface RememberManager
Parameters:
userId - The ID that uniquely identifies the user that has to be remembered.
hostIp - The ip address of the host from which the user accesses the application.
Returns:
A String that uniquely identifies the remembered user ID.
Throws:
RememberManagerException - An undefined number of exceptional cases or error situations can occur when a remember ID is created. They are all indicated by throwing an instance of RememberManagerException. It's up to the implementations of this interface to give more specific meanings to these exceptions.

eraseRememberId

public boolean eraseRememberId(String rememberId)
                        throws RememberManagerException
Description copied from interface: RememberManager
Removes one particular remember ID. This makes it instantly invalid.

Specified by:
eraseRememberId in interface RememberManager
Parameters:
rememberId - The remember ID that needs to be erased.
Returns:
true if the ID was successfully erased; or

false if this was not possible.

Throws:
RememberManagerException - An undefined number of exceptional cases or error situations can occur when a remember ID is erased. They are all indicated by throwing an instance of RememberManagerException. It's up to the implementations of this interface to give more specific meanings to these exceptions.

eraseUserRememberIds

public boolean eraseUserRememberIds(long userId)
                             throws RememberManagerException
Description copied from interface: RememberManager
Removes all remember IDs for a particular user. This makes all issued remember IDs instantly invalid.

Specified by:
eraseUserRememberIds in interface RememberManager
Parameters:
userId - The id that uniquely identifies the user whose remember IDs are to be erased.
Returns:
true if the IDs were successfully erased; or

false if this was not possible

Throws:
RememberManagerException - An undefined number of exceptional cases or error situations can occur when a remember ID is erased. They are all indicated by throwing an instance of RememberManagerException. It's up to the implementations of this interface to give more specific meanings to these exceptions.

eraseAllRememberIds

public void eraseAllRememberIds()
                         throws RememberManagerException
Description copied from interface: RememberManager
Removes all available remember ID. This makes all existing remember IDs instantly invalid and unusable for all users.

Specified by:
eraseAllRememberIds in interface RememberManager
Throws:
RememberManagerException - An undefined number of exceptional cases or error situations can occur when a remember ID is erased. They are all indicated by throwing an instance of RememberManagerException. It's up to the implementations of this interface to give more specific meanings to these exceptions.

getRememberedUserId

public long getRememberedUserId(String rememberId)
                         throws RememberManagerException
Description copied from interface: RememberManager
Retrieves the user ID that corresponds to a certain remember ID.

Specified by:
getRememberedUserId in interface RememberManager
Parameters:
rememberId - The remember ID that maps to the user ID.
Returns:
the ID of the user that corresponds to the provided remember ID; or

-1 if no user ID corresponds to the provided remember ID.

Throws:
RememberManagerException - An undefined number of exceptional cases or error situations can occur when a user ID is retrieved. They are all indicated by throwing an instance of RememberManagerException. It's up to the implementations of this interface to give more specific meanings to these exceptions.

purgeRememberIds

public void purgeRememberIds()
                      throws RememberManagerException
Description copied from interface: RememberManager
Removes all remember IDs that are expired. This means that all remember IDs where the lifetime has been exceeded, will be removed.

Specified by:
purgeRememberIds in interface RememberManager
Throws:
RememberManagerException - An undefined number of exceptional cases or error situations can occur when a remember ID is purged. They are all indicated by throwing an instance of RememberManagerException. It's up to the implementations of this interface to give more specific meanings to these exceptions.


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.