xportlets.proxymanager
Class ProxyStorage

java.lang.Object
  |
  +--xportlets.proxymanager.ProxyStorage

public class ProxyStorage
extends java.lang.Object

Provides convenience methods for retrieving and storing proxy credentials to/from the HttpSession object. This means the proxies will remain only for the remainder of the user's session (i.e., the proxies will be destroyed when the user logs out or the portal is restarted).


Constructor Summary
ProxyStorage()
          Creates an empty ProxyStorage.
 
Method Summary
 org.ietf.jgss.GSSCredential get(java.lang.String pHash)
          Retrieve the proxy credential stored under hash pHash.
 java.util.Hashtable getAll()
          Retrieves all proxy credentials from ProxyStorage.
 org.ietf.jgss.GSSCredential getDefault()
          Retrieve the default proxy credential.
 void load(javax.servlet.http.HttpSession _session)
          Checks to see if there are proxies in the HttpSession object session.
 java.lang.String put(org.ietf.jgss.GSSCredential aProxy)
          Places the proxy credential into ProxyStorage.
 org.ietf.jgss.GSSCredential remove(java.lang.String pHash)
          Removes the proxy credential stored under hash pHash.
 java.util.Hashtable removeExpired()
          Removes all expired certificates from ProxyStorage and puts them in the input Hashtable expiredProxies (e.g., for message reporting).
 void setDefault(java.lang.String pHash)
          Sets the default proxy credential to that stored under hash pHash.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyStorage

public ProxyStorage()
Creates an empty ProxyStorage.

Method Detail

load

public void load(javax.servlet.http.HttpSession _session)
          throws ProxyStorageException
Checks to see if there are proxies in the HttpSession object session. If proxies exist, they are loaded into ProxyStorage upon which the user can use the get(java.lang.String) method to retrieve specific credentials.

Throws:
ProxyStorageException - if there's a problem loading one or more proxy credentials from session storage.

get

public org.ietf.jgss.GSSCredential get(java.lang.String pHash)
Retrieve the proxy credential stored under hash pHash.

Returns:
proxy credential or null if proxy credential doesn't exist.

getDefault

public org.ietf.jgss.GSSCredential getDefault()
Retrieve the default proxy credential. Returns null if there are no proxy credentials. If there is just one proxy credential, it is the default proxy credential. Otherwise, we determine the default proxy credential through a variable (hash of default proxy credential) which is stored in the permanent storage area of the JetspeedUser object under ProxyStorage#DEFAULT_PROXY. If the variable hasn't been set yet, we just assume the default credential is the first credential.

Returns:
default proxy credential or null if default proxy credential doesn't exist.

setDefault

public void setDefault(java.lang.String pHash)
Sets the default proxy credential to that stored under hash pHash.


getAll

public java.util.Hashtable getAll()
Retrieves all proxy credentials from ProxyStorage.

Returns:
all proxy credentials in a Hashtable. Proxy credentials are stored under the hash of their DN.

put

public java.lang.String put(org.ietf.jgss.GSSCredential aProxy)
                     throws ProxyStorageException
Places the proxy credential into ProxyStorage. It will replace any existing proxy credential of the same DN.

Returns:
the hash of the credential which can be used to retrieve the credential using the get(java.lang.String) method or null if there was an error storing the proxy.
Throws:
ProxyStorageException - if there's a problem storing the proxy credential.

remove

public org.ietf.jgss.GSSCredential remove(java.lang.String pHash)
                                   throws ProxyStorageException
Removes the proxy credential stored under hash pHash.

Returns:
deleted proxy credential or null if proxy credential doesn't exist
Throws:
ProxyStorageException - if there's a problem removing the proxy credential.

removeExpired

public java.util.Hashtable removeExpired()
                                  throws ProxyStorageException,
                                         org.ietf.jgss.GSSException
Removes all expired certificates from ProxyStorage and puts them in the input Hashtable expiredProxies (e.g., for message reporting). expiredProxies should not be null.

Throws:
ProxyStorageException - if expiredProxies is null or if there's a problem removing expired proxy credentials.
org.ietf.jgss.GSSException