MyProxy (Java Globus API)

org.globus.myproxy
Class MyProxy

java.lang.Object
  |
  +--org.globus.myproxy.MyProxy

public class MyProxy
extends java.lang.Object

This class provides API for communicating with MyProxy servers. It provides three main functions for retreiving, removing and storing credentials on MyProxy server.
Note: This version only works with myproxy-0.2 and greater

More information about MyProxy is available on the MyProxy page

Curent Issues:
1) The code can only handle one line of error reply.
2) 'Lifetime' is not entirely implemented. It's unclear what it supposed to do. 3) This version is NOT backwards compatibile with previous MyProxy versions. It requires at least 0.2 (MYPROXYv2) protocol version. 4) It should probably be implemented as an instance instead of static method.


Field Summary
protected  Authorization authorization
           
static int DEFAULT_PORT
           
static int DESTROY_PROXY
           
static int GET_PROXY
           
protected  java.lang.String host
           
static int INFO_PROXY
           
static int MIN_PASSWORD_LENGTH
           
static java.lang.String MYPROXY_PROTOCOL_VERSION
           
protected  int port
           
static int PUT_PROXY
           
protected  java.security.cert.X509Certificate[] trustedCertificates
           
 
Constructor Summary
MyProxy()
           
MyProxy(java.lang.String host, int port)
           
 
Method Summary
 void destroy(GlobusProxy proxy, java.lang.String username, java.lang.String passphrase)
          Removes delegated credentials from MyProxy server.
static void destroy(java.lang.String host, int port, GlobusProxy proxy, java.lang.String username, java.lang.String passphrase)
          Removes delegated credentials from MyProxy server.
static void destroy(java.lang.String host, int port, GlobusProxy proxy, java.lang.String username, java.lang.String passphrase, java.lang.String subjectDN)
          Removes delegated credentials from MyProxy server.
 GlobusProxy get(GlobusProxy proxy, java.lang.String username, java.lang.String passphrase, int lifetime)
          Retreives delegated credentials from MyProxy server.
static GlobusProxy get(java.lang.String host, int port, GlobusProxy proxy, java.lang.String username, java.lang.String passphrase, int lifetime)
          Retreives delegated credentials from MyProxy server.
static GlobusProxy get(java.lang.String host, int port, GlobusProxy proxy, java.lang.String username, java.lang.String passphrase, int lifetime, java.lang.String subjectDN)
          Retreives delegated credentials from MyProxy server.
 GlobusProxy get(java.lang.String username, java.lang.String passphrase, int lifetime)
          Retreives delegated credentials from MyProxy server Anonymously (without local credentials) Notes: Performs simple verification of private/public keys of the delegated cerdential.
 Authorization getAuthorization()
           
 java.lang.String getHost()
           
 int getPort()
           
 java.security.cert.X509Certificate[] getTrustedCertificates()
           
 void put(GlobusProxy proxy, java.lang.String username, java.lang.String passphrase, int lifetime)
          Stores credentials on MyProxy server.
static void put(java.lang.String host, int port, GlobusProxy proxy, java.lang.String username, java.lang.String passphrase, int lifetime)
          Stores credentials on MyProxy server.
static void put(java.lang.String host, int port, GlobusProxy proxy, java.lang.String username, java.lang.String passphrase, int lifetime, java.lang.String subjectDN)
          Stores credentials on MyProxy server.
 void setAuthorization(Authorization authorization)
           
 void setHost(java.lang.String host)
           
 void setPort(int port)
           
 void setTrustedCertificates(java.security.cert.X509Certificate[] trustedCertificates)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_PASSWORD_LENGTH

public static final int MIN_PASSWORD_LENGTH
See Also:
Constant Field Values

MYPROXY_PROTOCOL_VERSION

public static final java.lang.String MYPROXY_PROTOCOL_VERSION
See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

GET_PROXY

public static final int GET_PROXY
See Also:
Constant Field Values

PUT_PROXY

public static final int PUT_PROXY
See Also:
Constant Field Values

INFO_PROXY

public static final int INFO_PROXY
See Also:
Constant Field Values

DESTROY_PROXY

public static final int DESTROY_PROXY
See Also:
Constant Field Values

host

protected java.lang.String host

port

protected int port

authorization

protected Authorization authorization

trustedCertificates

protected java.security.cert.X509Certificate[] trustedCertificates
Constructor Detail

MyProxy

public MyProxy()

MyProxy

public MyProxy(java.lang.String host,
               int port)
Method Detail

setHost

public void setHost(java.lang.String host)

getHost

public java.lang.String getHost()

setPort

public void setPort(int port)

getPort

public int getPort()

setAuthorization

public void setAuthorization(Authorization authorization)

getAuthorization

public Authorization getAuthorization()

setTrustedCertificates

public void setTrustedCertificates(java.security.cert.X509Certificate[] trustedCertificates)

getTrustedCertificates

public java.security.cert.X509Certificate[] getTrustedCertificates()

put

public void put(GlobusProxy proxy,
                java.lang.String username,
                java.lang.String passphrase,
                int lifetime)
         throws MyProxyException
Stores credentials on MyProxy server.

Parameters:
proxy - The GSI credentials to use.
username - The username to store the credentials under.
passphrase - The passphrase to use to encrypt the stored credentials.
lifetime - The requested lifetime of the stored credentials.
Throws:
MyProxyException - If an error occured during during the put operation.

destroy

public void destroy(GlobusProxy proxy,
                    java.lang.String username,
                    java.lang.String passphrase)
             throws MyProxyException
Removes delegated credentials from MyProxy server.

Parameters:
proxy - The local GSI credentials to use.
username - The username of the credentials to remove.
passphrase - The passphrase of the credentials to remove.
Throws:
MyProxyException - If an error occured during removal of the credentials.

get

public GlobusProxy get(java.lang.String username,
                       java.lang.String passphrase,
                       int lifetime)
                throws MyProxyException
Retreives delegated credentials from MyProxy server Anonymously (without local credentials) Notes: Performs simple verification of private/public keys of the delegated cerdential. Should be improved later. And only checks for RSA keys.

Parameters:
username - The username of the credentials to retreive.
passphrase - The passphrase of the credentials to retreive.
lifetime - The requested lifetime of the retreived credential.
Returns:
GlobusProxy The retreived delegated credentials.
Throws:
MyProxyException - If an error during retreival of the credential.

get

public GlobusProxy get(GlobusProxy proxy,
                       java.lang.String username,
                       java.lang.String passphrase,
                       int lifetime)
                throws MyProxyException
Retreives delegated credentials from MyProxy server. Notes: Performs simple verification of private/public keys of the delegated cerdential. Should be improved later. And only checks for RSA keys.

Parameters:
proxy - The local GSI credentials to use. Can be set to null if no local credentials.
username - The username of the credentials to retreive.
passphrase - The passphrase of the credentials to retreive.
lifetime - The requested lifetime of the retreived credential.
Returns:
GlobusProxy The retreived delegated credentials.
Throws:
MyProxyException - If an error during retreival of the credential.

put

public static void put(java.lang.String host,
                       int port,
                       GlobusProxy proxy,
                       java.lang.String username,
                       java.lang.String passphrase,
                       int lifetime)
                throws MyProxyException
Stores credentials on MyProxy server.

Parameters:
host - The hostname of MyProxy server.
port - The port number of MyProxy server.
proxy - The GSI credentials to use.
username - The username to store the credentials under.
passphrase - The passphrase to use to encrypt the stored credentials.
lifetime - The requested lifetime of the stored credentials.
Throws:
MyProxyException - If an error occured during during the put operation.

put

public static void put(java.lang.String host,
                       int port,
                       GlobusProxy proxy,
                       java.lang.String username,
                       java.lang.String passphrase,
                       int lifetime,
                       java.lang.String subjectDN)
                throws MyProxyException
Stores credentials on MyProxy server.

Parameters:
host - The hostname of MyProxy server.
port - The port number of MyProxy server.
proxy - The GSI credentials to use.
username - The username to store the credentials under.
passphrase - The passphrase to use to encrypt the stored credentials.
lifetime - The requested lifetime of the stored credentials.
subjectDN - The expected subject name of MyProxy server. This is used for security purposes. If null, host authentication will be performed.
Throws:
MyProxyException - If an error occured during during the put operation.

destroy

public static void destroy(java.lang.String host,
                           int port,
                           GlobusProxy proxy,
                           java.lang.String username,
                           java.lang.String passphrase)
                    throws MyProxyException
Removes delegated credentials from MyProxy server.

Parameters:
host - The hostname of MyProxy server.
port - The port number of MyProxy server.
proxy - The GSI credentials to use.
username - The username of the credentials to remove.
passphrase - The passphrase of the credentials to remove. Right now it is ignored by the MyProxy sever.
Throws:
MyProxyException - If an error occured during removal of the credentials.

destroy

public static void destroy(java.lang.String host,
                           int port,
                           GlobusProxy proxy,
                           java.lang.String username,
                           java.lang.String passphrase,
                           java.lang.String subjectDN)
                    throws MyProxyException
Removes delegated credentials from MyProxy server.

Parameters:
host - The hostname of MyProxy server.
port - The port number of MyProxy server.
proxy - The GSI credentials to use.
username - The username of the credentials to remove.
passphrase - The passphrase of the credentials to remove. Right now it is ignored by the MyProxy sever.
subjectDN - The expected subject name of MyProxy server. This is used for security purposes. If null, host authentication will be performed.
Throws:
MyProxyException - If an error occured during removal of the credentials.

get

public static GlobusProxy get(java.lang.String host,
                              int port,
                              GlobusProxy proxy,
                              java.lang.String username,
                              java.lang.String passphrase,
                              int lifetime)
                       throws MyProxyException
Retreives delegated credentials from MyProxy server. Notes: Performs simple verification of private/public keys of the delegated cerdential. Should be improved later. And only checks for RSA keys.

Parameters:
host - The hostname of MyProxy server.
port - The port number of MyProxy server.
proxy - The GSI credentials to use.
username - The username of the credentials to retreive.
passphrase - The passphrase of the credentials to retreive.
lifetime - The requested lifetime of the retreived credential.
Returns:
GlobusProxy The retreived delegated credentials.
Throws:
MyProxyException - If an error during retreival of the credential.

get

public static GlobusProxy get(java.lang.String host,
                              int port,
                              GlobusProxy proxy,
                              java.lang.String username,
                              java.lang.String passphrase,
                              int lifetime,
                              java.lang.String subjectDN)
                       throws MyProxyException
Retreives delegated credentials from MyProxy server. Notes: Performs simple verification of private/public keys of the delegated cerdential. Should be improved later. And only checks for RSA keys.

Parameters:
host - The hostname of MyProxy server.
port - The port number of MyProxy server.
proxy - The GSI credentials to use.
username - The username of the credentials to retreive.
passphrase - The passphrase of the credentials to retreive.
lifetime - The requested lifetime of the retreived credential.
subjectDN - The expected subject name of MyProxy server. This is used for security purposes. If null, host authentication will be performed.
Returns:
GlobusProxy The retreived delegated credentials.
Throws:
MyProxyException - If an error during retreival of the credential.