org.edg.security.delegation
Class DelegationClientHTTP

java.lang.Object
  |
  +--org.edg.security.delegation.DelegationClientHTTP
All Implemented Interfaces:
DelegationClient

public class DelegationClientHTTP
extends java.lang.Object
implements DelegationClient

The client implementation for the G-HTTPS protocol for the delegation system.


Field Summary
static java.security.Provider provider
           
 
Constructor Summary
DelegationClientHTTP()
           
 
Method Summary
protected  void checkResponseErrors(HTTPClient.HTTPResponse response)
          Checks the response for error codes.
protected  HTTPClient.HTTPConnection createConnection(java.lang.String url)
           
protected  HTTPClient.HTTPConnection createConnection(HTTPClient.URI destUri)
          Creates the coennection to the uri
 void delegate(java.util.Properties delegProps, java.lang.String delegId, java.lang.String url)
           
protected  java.security.cert.X509Certificate[] getChain(java.util.Properties prop)
          Loads the certificate chain from files specified in the properties file
protected  java.util.Collection getDelegatedChains(HTTPClient.HTTPResponse response)
           
protected  java.security.PrivateKey getPrivateKey(java.util.Properties prop)
          Loads a privete key from tha file specified in the properties.
 void init(java.lang.String configFile)
           
protected  java.security.cert.X509Certificate loadCert(java.lang.String fileName)
          Loads an indivudial certificate from a file.
static void main(java.lang.String[] args)
           
 java.util.Collection queryDelegatedCertChains(java.util.Properties delegProps, java.lang.String delegId, java.lang.String url)
           
protected  HTTPClient.HTTPResponse sendGetCertReq(HTTPClient.HTTPConnection connection, HTTPClient.URI destUri, java.lang.String delegId)
          Sends a certification reques to the specified uri.
protected  HTTPClient.HTTPResponse sendGetProxyInfo(HTTPClient.HTTPConnection connection, HTTPClient.URI destUri, java.lang.String delegId)
           
protected  HTTPClient.HTTPResponse sendPutCert(HTTPClient.HTTPConnection connection, HTTPClient.URI destUri, java.lang.String delegId)
          sends a put proxy cert
 void testDelegation(java.util.Properties prop, java.lang.String delegId, java.lang.String url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

provider

public static java.security.Provider provider
Constructor Detail

DelegationClientHTTP

public DelegationClientHTTP()
Method Detail

init

public void init(java.lang.String configFile)
Specified by:
init in interface DelegationClient

delegate

public void delegate(java.util.Properties delegProps,
                     java.lang.String delegId,
                     java.lang.String url)
              throws DelegationException
Specified by:
delegate in interface DelegationClient
DelegationException

queryDelegatedCertChains

public java.util.Collection queryDelegatedCertChains(java.util.Properties delegProps,
                                                     java.lang.String delegId,
                                                     java.lang.String url)
                                              throws DelegationException
Specified by:
queryDelegatedCertChains in interface DelegationClient
DelegationException

testDelegation

public void testDelegation(java.util.Properties prop,
                           java.lang.String delegId,
                           java.lang.String url)
                    throws DelegationException
DelegationException

getChain

protected java.security.cert.X509Certificate[] getChain(java.util.Properties prop)
                                                 throws DelegationException
Loads the certificate chain from files specified in the properties file

DelegationException

loadCert

protected java.security.cert.X509Certificate loadCert(java.lang.String fileName)
                                               throws DelegationException
Loads an indivudial certificate from a file.

DelegationException

getPrivateKey

protected java.security.PrivateKey getPrivateKey(java.util.Properties prop)
                                          throws DelegationException
Loads a privete key from tha file specified in the properties.

DelegationException

createConnection

protected HTTPClient.HTTPConnection createConnection(java.lang.String url)
                                              throws DelegationException
DelegationException

createConnection

protected HTTPClient.HTTPConnection createConnection(HTTPClient.URI destUri)
                                              throws DelegationException
Creates the coennection to the uri

DelegationException

sendGetCertReq

protected HTTPClient.HTTPResponse sendGetCertReq(HTTPClient.HTTPConnection connection,
                                                 HTTPClient.URI destUri,
                                                 java.lang.String delegId)
Sends a certification reques to the specified uri.

Returns:
response of the request

sendPutCert

protected HTTPClient.HTTPResponse sendPutCert(HTTPClient.HTTPConnection connection,
                                              HTTPClient.URI destUri,
                                              java.lang.String delegId)
                                       throws DelegationException
sends a put proxy cert

DelegationException

sendGetProxyInfo

protected HTTPClient.HTTPResponse sendGetProxyInfo(HTTPClient.HTTPConnection connection,
                                                   HTTPClient.URI destUri,
                                                   java.lang.String delegId)
                                            throws DelegationException
DelegationException

getDelegatedChains

protected java.util.Collection getDelegatedChains(HTTPClient.HTTPResponse response)

checkResponseErrors

protected void checkResponseErrors(HTTPClient.HTTPResponse response)
                            throws DelegationException
Checks the response for error codes. If the response is OK does nothing - if not, throws excpetions.

Parameters:
response - response to check
Throws:
DelegationException - if something unexpected occurred

main

public static void main(java.lang.String[] args)