com.uwyn.rife.authentication
Interface RememberManager

All Known Implementing Classes:
DatabaseRemember, PurgingRememberManager

public interface RememberManager

This interface defines the methods that classes with RememberManager functionalities have to implement.

A RememberManager is reponsible for coupling a user ID to an expiring remember ID. The remember ID is typically stored in a cookie in the browser and expires after a certain duration. An authentication element that uses a RememberManager, should erase the remember ID after using it once, create a new one immediately and send it to the client. This ensures that each remember ID can only be used once.

Since:
1.0
Version:
$Revision: 3643 $
Author:
Geert Bevin (gbevin[remove] at uwyn dot com)
See Also:
RememberMe

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.
 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.
 

Method Detail

getRememberDuration

long getRememberDuration()
Obtains the maximum time that a remember ID can be used before it becomes invalid.

Returns:
The maximum lifetime in milliseconds.
Since:
1.0

setRememberDuration

void setRememberDuration(long milliseconds)
Sets the maximum time that a remember ID can be used before it becomes invalid.

Parameters:
milliseconds - The lifetime in milliseconds.
Since:
1.0

createRememberId

String createRememberId(long userId,
                        String hostIp)
                        throws RememberManagerException
Starts a new session.

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.
Since:
1.0

eraseRememberId

boolean eraseRememberId(String rememberId)
                        throws RememberManagerException
Removes one particular remember ID. This makes it instantly invalid.

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.
Since:
1.0

eraseUserRememberIds

boolean eraseUserRememberIds(long userId)
                             throws RememberManagerException
Removes all remember IDs for a particular user. This makes all issued remember IDs instantly invalid.

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.
Since:
1.0

eraseAllRememberIds

void eraseAllRememberIds()
                         throws RememberManagerException
Removes all available remember ID. This makes all existing remember IDs instantly invalid and unusable for all users.

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.
Since:
1.0

getRememberedUserId

long getRememberedUserId(String rememberId)
                         throws RememberManagerException
Retrieves the user ID that corresponds to a certain remember ID.

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.
Since:
1.0

purgeRememberIds

void purgeRememberIds()
                      throws RememberManagerException
Removes all remember IDs that are expired. This means that all remember IDs where the lifetime has been exceeded, will be removed.

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.
Since:
1.0


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