iaik.security.ssl
Class DefaultSessionManager

java.lang.Object
  |
  +--iaik.security.ssl.SessionManager
        |
        +--iaik.security.ssl.DefaultSessionManager

public class DefaultSessionManager
extends SessionManager

This class implements a simple Default SessionManager. Sessions are stored with the IP address of the peer as key. To get a session from the cache a SSL server calls getSession(addr, id) with the IP address of the client and the session id if the client wants to resume a previous session. If there is no session in the cache or if the cached session has a differend id this method returns null.

A SSL client calls this method with no session id (= null). If there already exists a session to this host the client tries to resume it.


Constructor Summary
DefaultSessionManager()
          Create only one sessin manager for all SSLSockets.
 
Method Summary
protected  void cacheSession(SSLTransport transport, Session session)
          Put a session into the session cache.
 long getResumePeriod()
          Returns the resume period of this session manager.
protected  Session getSession(SSLTransport transport, java.lang.Object sessionID)
          Returns a session from the cache.
 void setResumePeriod(long period)
          Sets the resume period of cached sessions.
 java.lang.String toString()
          Returns some statistics about the sessions cache.
 
Methods inherited from class iaik.security.ssl.SessionManager
getDefault, setDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultSessionManager

public DefaultSessionManager()
Create only one sessin manager for all SSLSockets.
Method Detail

setResumePeriod

public void setResumePeriod(long period)
Sets the resume period of cached sessions. After this time a session is removed from the session cache and therefore cann't be resumed. If the SSLSocket connects again to this host he has to renegotiate the security parameters.
Parameters:
period - the resume period in seconds

getResumePeriod

public long getResumePeriod()
Returns the resume period of this session manager.
Returns:
the resume period in seconds

cacheSession

protected void cacheSession(SSLTransport transport,
                            Session session)
Put a session into the session cache. For internal use.
Overrides:
cacheSession in class SessionManager
Parameters:
socket - the socket which wants to cache this session
session - the session to cache

getSession

protected Session getSession(SSLTransport transport,
                             java.lang.Object sessionID)
Returns a session from the cache. Old sessions are removed automatically. For internal use.
Overrides:
getSession in class SessionManager
Parameters:
socket - the socket which wants to look for a session
sessionID - the ID of the session which should be resumed or null if this method is called by a SSL client.
Returns:
the session from the cache or null

toString

public java.lang.String toString()
Returns some statistics about the sessions cache.
Overrides:
toString in class java.lang.Object
Returns:
a string representation of some statistics