Proxy Manager Developer's Guide
Proxy Manager Developer's Guide
This guide is for developers who are writing portlets that want
to access the GSI proxy credentials fetched by our Proxy Manager
portlet.
Proxy credentials are stored in the session context which can be
obtained from the RunData
object. The GSI proxy credentials are stored in a ProxyStorage
object as a hash table and can be
retrieved using
the key "proxies". Each proxy credential is stored in the hash table
under the
hash of the proxy credential's DN.
For portlet developers, we provide a ProxyManager
class
which provides convenient static methods for accessing these proxy
credentials, so that the developers don't even have to know the
implementation of ProxyStorage,
which may be subject to change. The ProxyManager class provides
basically two ways to
retrieve proxy credentials:
-
Retrieve one "default" proxy credential: getDefaultProxy()
This is the most common retrieval method for portal developers
to use since usually only one proxy credential is needed to perform an
operation. The "default" proxy credential is specified by the user as
the proxy credential they want to use to perform
authentication/authorization. If the user only has one proxy credential
loaded, then that proxy credential is considered to be the default.
-
Retrieve all proxy credentials: getAllProxies()
This allows a portal developer to retrieve all proxy credentials
from the user.
The following is a sample of code that shows how to use the proxy
retrieval
methods.
public void someFunction( RunData runData ) { // Retrieve the JetspeedUser object HttpSession session = runData.getSession(); GSSCredential proxy = ProxyManager.getDefaultProxy(session); if(proxy == null) { // proxy may be null if anything goes wrong } ... // get all proxies try { Hashtable proxies = ProxyManager.getAllProxies(session); Enumeration proxy_keys = proxies.keys(); while ( proxy_keys.hasMoreElements() ) { String hash = proxy_keys.nextElement(); GSSCredential proxy = (GSSCredentialproxies.get(hash); ... } } catch(ProxyStorageException pse) { // exception handling ... }
...
Click the link below for more detailed ProxyManager documentation.
JavaDoc
ProxyManager API documentation
|