xportlets.proxymanager
Class ProxyTable

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

public class ProxyTable
extends java.lang.Object

Provides convenience methods for retrieving and storing proxy credentials to/from the JetspeedUser object. A ProxyTable has can store proxies in 2 modes: temporary and permanent. Temporary means that ProxyTable stores proxy credentials in the temporary storage area of the JetspeedUser 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). Permanent means that the ProxyTable stores proxy credentials in the permanent storage area of the JetspeedUser object and so will persist until they expire (i.e., stored to disk).


Field Summary
static java.lang.String DEFAULT_PROXY
           
 
Constructor Summary
ProxyTable()
          Creates an empty ProxyTable.
 
Method Summary
 org.globus.security.GlobusProxy get(java.lang.String pHash)
          Retrieve the proxy credential stored under hash pHash.
 java.util.Hashtable getAll()
          Retrieves all proxy credentials from ProxyTable.
 org.globus.security.GlobusProxy getDefault()
          Retrieve the default proxy credential.
 void load(org.apache.jetspeed.om.security.JetspeedUser jUser)
          Checks to see if there are proxies in the temporary and permanent storage areas of the JetspeedUser object jUser.
 java.lang.String put(org.globus.security.GlobusProxy aProxy, boolean permStorage)
          Places the proxy credential into ProxyTable.
 org.globus.security.GlobusProxy remove(java.lang.String pHash)
          Removes the proxy credential stored under hash pHash.
 void removeExpired(java.util.Hashtable expiredProxies)
          Removes all expired certificates from ProxyTable 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.
static void setDefault(java.lang.String pHash, org.apache.jetspeed.om.security.JetspeedUser jUser)
          Sets the default proxy credential to that stored under hash pHash for JetspeedUser jUser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PROXY

public static final java.lang.String DEFAULT_PROXY
Constructor Detail

ProxyTable

public ProxyTable()
Creates an empty ProxyTable.
Method Detail

load

public void load(org.apache.jetspeed.om.security.JetspeedUser jUser)
          throws ProxyTableException
Checks to see if there are proxies in the temporary and permanent storage areas of the JetspeedUser object jUser. If proxies exist, they are loaded into ProxyTable upon which the user can use the get(java.lang.String) method to retrieve specific credentials.
Throws:
ProxyTableException - if there's a problem loading one or more proxy credentials from permanent storage.

get

public org.globus.security.GlobusProxy 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.globus.security.GlobusProxy 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 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 static void setDefault(java.lang.String pHash,
                              org.apache.jetspeed.om.security.JetspeedUser jUser)
                       throws ProxyTableException
Sets the default proxy credential to that stored under hash pHash for JetspeedUser jUser.
Throws:
ProxyTableException - if error in saving user's JetspeedUser object.

setDefault

public void setDefault(java.lang.String pHash)
                throws ProxyTableException
Sets the default proxy credential to that stored under hash pHash.
Throws:
ProxyTableException - if error in saving user's JetspeedUser object.

getAll

public java.util.Hashtable getAll()
Retrieves all proxy credentials from ProxyTable.
Returns:
all proxy credentials in a Hashtable. Proxy credentials are stored under the hash of their DN.

put

public java.lang.String put(org.globus.security.GlobusProxy aProxy,
                            boolean permStorage)
                     throws ProxyTableException
Places the proxy credential into ProxyTable. If permStorage is set to true, the proxy credential is stored in the permanent storage area. Otherwise, the proxy credential is stored in the temporary storage area. 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:
ProxyTableException - if there's a problem storing the proxy credential.

remove

public org.globus.security.GlobusProxy remove(java.lang.String pHash)
                                       throws ProxyTableException
Removes the proxy credential stored under hash pHash.
Returns:
deleted proxy credential or null if proxy credential doesn't exist
Throws:
ProxyTableException - if there's a problem removing the proxy credential.

removeExpired

public void removeExpired(java.util.Hashtable expiredProxies)
                   throws ProxyTableException
Removes all expired certificates from ProxyTable and puts them in the input Hashtable expiredProxies (e.g., for message reporting). expiredProxies should not be null.
Throws:
ProxyTableException - if expiredProxies is null or if there's a problem removing expired proxy credentials.