org.jasig.portal.security.provider.saml
Class Resource

java.lang.Object
  extended by org.jasig.portal.security.provider.saml.Resource

public class Resource
extends Object

A class that "wraps" a simple resource that is retrieved from a Web Service Provider (WSP) as a String. The resource is represented by a URL.

Author:
Adam Rybicki

Constructor Summary
Resource()
           
 
Method Summary
 String getResource()
          Get the resource as it was retrieved from the WSP.
 String getResourceUrl()
          Get the URL of the resource.
 org.apache.http.conn.ssl.SSLSocketFactory getWSPSocketFactory()
          Returns an instance of SSLSocketFactory suitable for use with the Apache Commons HTTP Client.
 void setResource(String resource)
          Set the resource as it was retrieved from the WSP.
 void setResourceUrl(String resourceUrl)
          Get the URL of the resource.
 void setupWSPClientConnection(SAMLSession samlSession)
          Sets up the SSL parameters of a connection to the WSP, including the client certificate and server certificate trust.
 void setWSPClientKeystore(String ks, String pass)
          This method provides an alternative method of providing client TLS certificate to send to the WSP to identify the client.
 void setWSPClientPrivateKeyAndCert(String pkFile, String certFile)
          This method is used to specify the private key and certificate to use to identify the client to the WSP.
 void setWSPClientTrustStore(String ks, String pass)
          This method allows to specify a Java TrustStore of server X.509 certificates to trust.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Resource

public Resource()
Method Detail

getResource

public String getResource()
Get the resource as it was retrieved from the WSP.

Returns:
the resource represented as a String

setResource

public void setResource(String resource)
Set the resource as it was retrieved from the WSP.

Parameters:
resource - the resource to set

getResourceUrl

public String getResourceUrl()
Get the URL of the resource.

Returns:
the resourceUrl

setResourceUrl

public void setResourceUrl(String resourceUrl)
Get the URL of the resource.

Parameters:
resourceUrl - the resourceUrl to set

setWSPClientPrivateKeyAndCert

public void setWSPClientPrivateKeyAndCert(String pkFile,
                                          String certFile)
This method is used to specify the private key and certificate to use to identify the client to the WSP. The TLS layer will present the certificate to the WSP.

Parameters:
pkFile - file name of the PEM-encoded private key
certFile - file name of the PEM-encoded certificate

setWSPClientKeystore

public void setWSPClientKeystore(String ks,
                                 String pass)
This method provides an alternative method of providing client TLS certificate to send to the WSP to identify the client.

Parameters:
ks - file name of Java KeyStore containing the certificate and private key to present to the WSP
pass - KeyStore password (must not be null)
See Also:
#setWSPClientPrivateKeyAndCert()

setWSPClientTrustStore

public void setWSPClientTrustStore(String ks,
                                   String pass)
This method allows to specify a Java TrustStore of server X.509 certificates to trust. These may be either signing Certificate Authority (CA) certificates of self-signed certificates for WSPs to trust. Java normally trusts all servers that present valid certificates signed by a recognized CA. This method allows to securely communicate with institution-specific WSP.

Parameters:
ks - file name of a Java KeyStore
pass - password to access the KeyStore

getWSPSocketFactory

public org.apache.http.conn.ssl.SSLSocketFactory getWSPSocketFactory()
Returns an instance of SSLSocketFactory suitable for use with the Apache Commons HTTP Client. This socket factory is set up with the previously set keys and/or certificates for communicating with the WSP.

Returns:
SSLSocketFactory suitable for use with the Apache Commons HTTP Client

setupWSPClientConnection

public void setupWSPClientConnection(SAMLSession samlSession)
                              throws MalformedURLException
Sets up the SSL parameters of a connection to the WSP, including the client certificate and server certificate trust. The program that set up the SAMLSession object is responsible for providing these optional SSL parameters.

Parameters:
samlSession - SAMLSession that already must contain a valid HttpClient for the WSP
resource - Resource wrapper class that contains a resource URL
Throws:
MalformedURLException


Copyright © 2011 Jasig. All Rights Reserved.