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
           
protected  int _maxAgeSeconds
           
 
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 boundary.
 void setMaxAge(int ageSeconds)
          Sets the expiration timeout for nonces, in seconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_dateFormat

protected static InternetDateFormat _dateFormat

_maxAgeSeconds

protected int _maxAgeSeconds
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

setMaxAge

public void setMaxAge(int ageSeconds)
Description copied from interface: NonceVerifier
Sets the expiration timeout for nonces, in seconds.

Specified by:
setMaxAge 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 boundary. 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 © 2012 Sxip. All Rights Reserved.