org.globus.myproxy
Class MyProxy

java.lang.Object
  extended byorg.globus.myproxy.MyProxy

public class MyProxy
extends Object

This class provides API for communicating with MyProxy servers. It provides main functions for retrieving, removing and storing credentials on MyProxy server. It also provides functions for getting credential information and changing passwords.
Note: This version only works with myproxy-0.2 and greater

More information about MyProxy is available on the MyProxy page


Field Summary
protected  Authorization authorization
           
static int CHANGE_PASSWORD
           
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 changePassword(GSSCredential credential, ChangePasswordParams params)
          Changes the password of the credential on the MyProxy server.
 void destroy(GSSCredential credential, DestroyParams params)
          Removes delegated credentials from MyProxy server.
 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, GetParams params)
          Retrieves delegated credentials from MyProxy server.
 GSSCredential get(GSSCredential credential, String username, String passphrase, int lifetime)
          Retrieves delegated credentials from MyProxy server.
static GSSCredential get(String host, int port, GSSCredential credential, String username, String passphrase, int lifetime)
          Retrieves delegated credentials from MyProxy server.
static GSSCredential get(String host, int port, GSSCredential credential, String username, String passphrase, int lifetime, String subjectDN)
          Retrieves delegated credentials from MyProxy server.
 GSSCredential get(String username, String passphrase, int lifetime)
          Retrieves delegated credentials from MyProxy server Anonymously (without local credentials) Notes: Performs simple verification of private/public keys of the delegated credential.
 Authorization getAuthorization()
           
 String getHost()
           
 int getPort()
           
 CredentialInfo[] info(GSSCredential credential, InfoParams params)
          Retrieves credential information from MyProxy server.
 CredentialInfo info(GSSCredential credential, String username, String passphrase)
          Retrieves credential information from MyProxy server.
 void put(GSSCredential credential, InitParams params)
          Stores credentials on 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
See Also:
Constant Field Values

MYPROXY_PROTOCOL_VERSION

public static final 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

CHANGE_PASSWORD

public static final int CHANGE_PASSWORD
See Also:
Constant Field Values

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 occurred during the operation.

put

public void put(GSSCredential credential,
                InitParams params)
         throws MyProxyException
Stores credentials on MyProxy server.

Parameters:
credential - The GSI credentials to use.
params - The parameters for the put operation.
Throws:
MyProxyException - If an error occurred during the 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 occurred during the operation.

destroy

public void destroy(GSSCredential credential,
                    DestroyParams params)
             throws MyProxyException
Removes delegated credentials from MyProxy server.

Parameters:
credential - The local GSI credentials to use.
params - The parameters for the destroy operation.
Throws:
MyProxyException - If an error occurred during the operation.

changePassword

public void changePassword(GSSCredential credential,
                           ChangePasswordParams params)
                    throws MyProxyException
Changes the password of the credential on the MyProxy server.

Parameters:
credential - The local GSI credentials to use.
params - The parameters for the change password operation.
Throws:
MyProxyException - If an error occurred during the operation.

info

public CredentialInfo info(GSSCredential credential,
                           String username,
                           String passphrase)
                    throws MyProxyException
Retrieves credential information from MyProxy server. Only the information of the default credential is returned by this operation.

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:
The credential information of the default credential.
Throws:
MyProxyException - If an error occurred during the operation.

info

public CredentialInfo[] info(GSSCredential credential,
                             InfoParams params)
                      throws MyProxyException
Retrieves credential information from MyProxy server.

Parameters:
credential - The local GSI credentials to use.
params - The parameters for the info operation.
Returns:
The array of credential information of all the user's credentials.
Throws:
MyProxyException - If an error occurred during the operation.

get

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

Parameters:
username - The username of the credentials to retrieve.
passphrase - The passphrase of the credentials to retrieve.
lifetime - The requested lifetime of the retrieved credential.
Returns:
GSSCredential The retrieved delegated credentials.
Throws:
MyProxyException - If an error occurred during the operation.

get

public GSSCredential get(GSSCredential credential,
                         String username,
                         String passphrase,
                         int lifetime)
                  throws MyProxyException
Retrieves delegated credentials from MyProxy server. Notes: Performs simple verification of private/public keys of the delegated credential. 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 retrieve.
passphrase - The passphrase of the credentials to retrieve.
lifetime - The requested lifetime of the retrieved credential.
Returns:
GSSCredential The retrieved delegated credentials.
Throws:
MyProxyException - If an error occurred during the operation.

get

public GSSCredential get(GSSCredential credential,
                         GetParams params)
                  throws MyProxyException
Retrieves delegated credentials from MyProxy server.

Parameters:
credential - The local GSI credentials to use. Can be set to null if no local credentials.
params - The parameters for the get operation.
Returns:
GSSCredential The retrieved delegated credentials.
Throws:
MyProxyException - If an error occurred during the operation.

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 occurred 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 occurred 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 occurred during the operation.

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 occurred during the operation.

get

public static GSSCredential get(String host,
                                int port,
                                GSSCredential credential,
                                String username,
                                String passphrase,
                                int lifetime)
                         throws MyProxyException
Retrieves delegated credentials from MyProxy server. Notes: Performs simple verification of private/public keys of the delegated credential. 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 retrieve.
passphrase - The passphrase of the credentials to retrieve.
lifetime - The requested lifetime of the retrieved credential.
Returns:
GSSCredential The retrieved delegated credentials.
Throws:
MyProxyException - If an error occurred during the operation.

get

public static GSSCredential get(String host,
                                int port,
                                GSSCredential credential,
                                String username,
                                String passphrase,
                                int lifetime,
                                String subjectDN)
                         throws MyProxyException
Retrieves delegated credentials from MyProxy server. Notes: Performs simple verification of private/public keys of the delegated credential. 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 retrieve.
passphrase - The passphrase of the credentials to retrieve.
lifetime - The requested lifetime of the retrieved 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 retrieved delegated credentials.
Throws:
MyProxyException - If an error occurred during the operation.