Java Globus API: Class MyProxy

org.globus.myproxy
Class MyProxy

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

public class MyProxy
extends 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
           
protected  GSSContext context
           
static int DEFAULT_PORT
           
static int DESTROY_PROXY
           
static int GET_PROXY
           
protected  String host
           
static int INFO_PROXY
           
static int MIN_PASSWORD_LENGTH
           
static String MYPROXY_PROTOCOL_VERSION
           
protected  int port
           
static int PUT_PROXY
           
 
Constructor Summary
MyProxy()
           
MyProxy(String host, int port)
           
 
Method Summary
 void destroy(GSSCredential credential, String username, String passphrase)
          Removes delegated credentials from MyProxy server.
static void destroy(String host, int port, GSSCredential credential, String username, String passphrase)
          Removes delegated credentials from MyProxy server.
static void destroy(String host, int port, GSSCredential credential, String username, String passphrase, String subjectDN)
          Removes delegated credentials from MyProxy server.
 GSSCredential get(GSSCredential credential, String username, String passphrase, int lifetime)
          Retreives delegated credentials from MyProxy server.
static GSSCredential get(String host, int port, GSSCredential credential, String username, String passphrase, int lifetime)
          Retreives delegated credentials from MyProxy server.
static GSSCredential get(String host, int port, GSSCredential credential, String username, String passphrase, int lifetime, String subjectDN)
          Retreives delegated credentials from MyProxy server.
 GSSCredential get(String username, 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()
           
 String getHost()
           
 int getPort()
           
 CredentialInfo info(GSSCredential credential, String username, String passphrase)
          Retreives credential information from MyProxy server.
 void put(GSSCredential credential, String username, String passphrase, int lifetime)
          Stores credentials on MyProxy server.
static void put(String host, int port, GSSCredential credential, String username, String passphrase, int lifetime)
          Stores credentials on MyProxy server.
static void put(String host, int port, GSSCredential credential, String username, String passphrase, int lifetime, String subjectDN)
          Stores credentials on MyProxy server.
 void setAuthorization(Authorization authorization)
           
 void setHost(String host)
           
 void setPort(int port)
           
 
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

MYPROXY_PROTOCOL_VERSION

public static final String MYPROXY_PROTOCOL_VERSION

DEFAULT_PORT

public static final int DEFAULT_PORT

GET_PROXY

public static final int GET_PROXY

PUT_PROXY

public static final int PUT_PROXY

INFO_PROXY

public static final int INFO_PROXY

DESTROY_PROXY

public static final int DESTROY_PROXY

host

protected String host

port

protected int port

authorization

protected Authorization authorization

context

protected GSSContext context
Constructor Detail

MyProxy

public MyProxy()

MyProxy

public MyProxy(String host,
               int port)
Method Detail

setHost

public void setHost(String host)

getHost

public String getHost()

setPort

public void setPort(int port)

getPort

public int getPort()

setAuthorization

public void setAuthorization(Authorization authorization)

getAuthorization

public Authorization getAuthorization()

put

public void put(GSSCredential credential,
                String username,
                String passphrase,
                int lifetime)
         throws MyProxyException
Stores credentials on MyProxy server.
Parameters:
credential - 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(GSSCredential credential,
                    String username,
                    String passphrase)
             throws MyProxyException
Removes delegated credentials from MyProxy server.
Parameters:
credential - 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.

info

public CredentialInfo info(GSSCredential credential,
                           String username,
                           String passphrase)
                    throws MyProxyException
Retreives credential information from MyProxy server.
Parameters:
credential - The local GSI credentials to use.
username - The username of the credentials to remove.
passphrase - The passphrase of the credentials to remove.
Returns:
CredentialInfo credential information
Throws:
MyProxyException - If an error occured during removal of the credentials.

get

public GSSCredential get(String username,
                         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:
GSSCredential The retreived delegated credentials.
Throws:
MyProxyException - If an error during retreival of the credential.

get

public GSSCredential get(GSSCredential credential,
                         String username,
                         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:
credential - 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:
GSSCredential The retreived delegated credentials.
Throws:
MyProxyException - If an error during retreival of the credential.

put

public static void put(String host,
                       int port,
                       GSSCredential credential,
                       String username,
                       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.
credential - 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(String host,
                       int port,
                       GSSCredential credential,
                       String username,
                       String passphrase,
                       int lifetime,
                       String subjectDN)
                throws MyProxyException
Stores credentials on MyProxy server.
Parameters:
host - The hostname of MyProxy server.
port - The port number of MyProxy server.
credential - 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(String host,
                           int port,
                           GSSCredential credential,
                           String username,
                           String passphrase)
                    throws MyProxyException
Removes delegated credentials from MyProxy server.
Parameters:
host - The hostname of MyProxy server.
port - The port number of MyProxy server.
credential - 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(String host,
                           int port,
                           GSSCredential credential,
                           String username,
                           String passphrase,
                           String subjectDN)
                    throws MyProxyException
Removes delegated credentials from MyProxy server.
Parameters:
host - The hostname of MyProxy server.
port - The port number of MyProxy server.
credential - 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 GSSCredential get(String host,
                                int port,
                                GSSCredential credential,
                                String username,
                                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.
credential - 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:
GSSCredential The retreived delegated credentials.
Throws:
MyProxyException - If an error during retreival of the credential.

get

public static GSSCredential get(String host,
                                int port,
                                GSSCredential credential,
                                String username,
                                String passphrase,
                                int lifetime,
                                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.
credential - 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:
GSSCredential The retreived delegated credentials.
Throws:
MyProxyException - If an error during retreival of the credential.