org.apache.directory.server.kerberos.shared.replay
Class ReplayCacheImpl

java.lang.Object
  extended by org.apache.directory.server.kerberos.shared.replay.ReplayCacheImpl
All Implemented Interfaces:
ReplayCache

public class ReplayCacheImpl
extends Object
implements ReplayCache

"The replay cache will store at least the server name, along with the client name, time, and microsecond fields from the recently-seen authenticators, and if a matching tuple is found, the KRB_AP_ERR_REPEAT error is returned." We will store the entries in Ehacache instance

Author:
Apache Directory Project

Nested Class Summary
 class ReplayCacheImpl.ReplayCacheEntry
          A structure to hold an entry
 
Constructor Summary
ReplayCacheImpl(net.sf.ehcache.Cache cache)
          Creates a new instance of InMemoryReplayCache.
ReplayCacheImpl(net.sf.ehcache.Cache cache, long clockSkew)
          Creates a new instance of InMemoryReplayCache.
 
Method Summary
 void clear()
          removes all the elements present in the cache
 boolean isReplay(KerberosPrincipal serverPrincipal, KerberosPrincipal clientPrincipal, KerberosTime clientTime, int clientMicroSeconds)
          Check if an entry is a replay or not.
 void save(KerberosPrincipal serverPrincipal, KerberosPrincipal clientPrincipal, KerberosTime clientTime, int clientMicroSeconds)
          Add a new entry into the cache.
 void setClockSkew(long clockSkew)
          Sets the clock skew.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplayCacheImpl

public ReplayCacheImpl(net.sf.ehcache.Cache cache)
Creates a new instance of InMemoryReplayCache. Sets the delay between each cleaning run to 5 seconds.


ReplayCacheImpl

public ReplayCacheImpl(net.sf.ehcache.Cache cache,
                       long clockSkew)
Creates a new instance of InMemoryReplayCache. Sets the delay between each cleaning run to 5 seconds. Sets the clockSkew to the given value

Parameters:
clockSkew - the allowed skew (milliseconds)
Method Detail

setClockSkew

public void setClockSkew(long clockSkew)
Sets the clock skew.

Parameters:
clockSkew -

isReplay

public boolean isReplay(KerberosPrincipal serverPrincipal,
                        KerberosPrincipal clientPrincipal,
                        KerberosTime clientTime,
                        int clientMicroSeconds)
Check if an entry is a replay or not.

Specified by:
isReplay in interface ReplayCache
Parameters:
serverPrincipal - The server principal
clientPrincipal - The client principal
clientTime - The client time
clientMicroSeconds - The client microsecond
Returns:
true if the request is a replay.

save

public void save(KerberosPrincipal serverPrincipal,
                 KerberosPrincipal clientPrincipal,
                 KerberosTime clientTime,
                 int clientMicroSeconds)
Add a new entry into the cache. A thread will clean all the timed out entries.

Specified by:
save in interface ReplayCache
Parameters:
serverPrincipal - The server principal
clientPrincipal - The client principal
clientTime - The client time
clientMicroSeconds - The client microsecond

clear

public void clear()
removes all the elements present in the cache

Specified by:
clear in interface ReplayCache


Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.