org.openid4java.consumer
Class AbstractNonceVerifier

java.lang.Object
  extended by org.openid4java.consumer.AbstractNonceVerifier
All Implemented Interfaces:
NonceVerifier
Direct Known Subclasses:
EhcacheNonceVerifier, InMemoryNonceVerifier

public abstract class AbstractNonceVerifier
extends java.lang.Object
implements NonceVerifier

Author:
Marius Scurtescu, Johnny Bufu

Field Summary
protected static InternetDateFormat _dateFormat
           
private static org.apache.commons.logging.Log _log
           
protected  int _maxAge
           
private static boolean DEBUG
           
 
Fields inherited from interface org.openid4java.consumer.NonceVerifier
INVALID_TIMESTAMP, OK, SEEN, TOO_OLD
 
Constructor Summary
protected AbstractNonceVerifier(int maxAge)
           
 
Method Summary
 int getMaxAge()
          Returns the expiration timeout for nonces, in seconds
protected  boolean isTooOld(java.util.Date now, java.util.Date nonce)
           
protected abstract  int seen(java.util.Date now, java.lang.String opUrl, java.lang.String nonce)
          Subclasses should implement this method and check if the nonce was seen before.
 int seen(java.lang.String opUrl, java.lang.String nonce)
          Checks if nonce date is valid and if it is in the max age boudary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

private static org.apache.commons.logging.Log _log

DEBUG

private static final boolean DEBUG

_dateFormat

protected static InternetDateFormat _dateFormat

_maxAge

protected int _maxAge
Constructor Detail

AbstractNonceVerifier

protected AbstractNonceVerifier(int maxAge)
Parameters:
maxAge - maximum token age in seconds
Method Detail

getMaxAge

public int getMaxAge()
Description copied from interface: NonceVerifier
Returns the expiration timeout for nonces, in seconds

Specified by:
getMaxAge in interface NonceVerifier

seen

public int seen(java.lang.String opUrl,
                java.lang.String nonce)
Checks if nonce date is valid and if it is in the max age boudary. Other checks are delegated to seen(java.util.Date, String, String)

Specified by:
seen in interface NonceVerifier
Returns:
NonceVerifier.OK only if this nonce has a valid time stamp, the time stamp did not age and the nonce was not seen before.

seen

protected abstract int seen(java.util.Date now,
                            java.lang.String opUrl,
                            java.lang.String nonce)
Subclasses should implement this method and check if the nonce was seen before. The nonce timestamp was verified at this point, it is valid and it is in the max age boudary.

Parameters:
now - The timestamp used to check the max age boudary.

isTooOld

protected boolean isTooOld(java.util.Date now,
                           java.util.Date nonce)


Copyright 2006-2007 Sxip Identity Corporation