com.arsdigita.kernel.security
Class CookieManager

java.lang.Object
  extended bycom.arsdigita.kernel.security.CredentialManager
      extended bycom.arsdigita.kernel.security.CookieManager

public class CookieManager
extends CredentialManager

Manages a string value stored in a cookie.

Author:
Sameer Ajmani
See Also:
CookieLoginModule

Field Summary
static String versionId
           
 
Constructor Summary
CookieManager()
           
 
Method Summary
protected  void deleteValue()
          Deletes the cookie named getModule().getCredentialName().
protected  int getCookieMaxAge()
          Determines the correct max age for the cookie in seconds.
protected  String getValue()
          Returns the value of the cookie named getModule().getCredentialName().
 void initialize(CredentialLoginModule module, javax.security.auth.Subject subject, javax.security.auth.callback.CallbackHandler handler, Map shared, Map options)
          Initializes this with the login context information.
protected  void setValue(String value)
          Sets the cookie named getModule().getCredentialName() to the given value.
protected  boolean shouldSetValue(String value)
          Determines whether setValue() should be called.
 
Methods inherited from class com.arsdigita.kernel.security.CredentialManager
getModule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

CookieManager

public CookieManager()
Method Detail

initialize

public void initialize(CredentialLoginModule module,
                       javax.security.auth.Subject subject,
                       javax.security.auth.callback.CallbackHandler handler,
                       Map shared,
                       Map options)
Description copied from class: CredentialManager
Initializes this with the login context information. Called by CredentialLoginModule.initialize().

Overrides:
initialize in class CredentialManager
Parameters:
module - the CredentialLoginModule associated with this CredentialManager.

shouldSetValue

protected boolean shouldSetValue(String value)
                          throws javax.security.auth.login.LoginException
Determines whether setValue() should be called.

Specified by:
shouldSetValue in class CredentialManager
Parameters:
value - the new value for the credential
Returns:
true if the credential is not set or has the wrong value or should be renewed, false otherwise.
Throws:
javax.security.auth.login.LoginException - if an error occurs.

getValue

protected final String getValue()
                         throws javax.security.auth.login.LoginException
Returns the value of the cookie named getModule().getCredentialName().

Specified by:
getValue in class CredentialManager
Returns:
the value of the cookie named getModule().getCredentialName().
Throws:
CredentialNotFoundException - if the cookie is not in the current request.
javax.security.auth.login.LoginException - if an error occurs.

setValue

protected final void setValue(String value)
                       throws javax.security.auth.login.LoginException
Sets the cookie named getModule().getCredentialName() to the given value.

Specified by:
setValue in class CredentialManager
Parameters:
value - the new value for the credential
Throws:
javax.security.auth.login.LoginException - if an error occurs.

deleteValue

protected final void deleteValue()
                          throws javax.security.auth.login.LoginException
Deletes the cookie named getModule().getCredentialName().

Specified by:
deleteValue in class CredentialManager
Throws:
javax.security.auth.login.LoginException - if an error occurs.

getCookieMaxAge

protected int getCookieMaxAge()
                       throws javax.security.auth.login.LoginException
Determines the correct max age for the cookie in seconds. A return value of -1 means the cookie should be deleted when the client's browser quits.

Returns:
FOREVER_SECS if the user has requested permanent login; -1 otherwise.
Throws:
javax.security.auth.login.LoginException


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC