authentication
Class SaslResponse

java.lang.Object
  extended by authentication.SaslResponse

public class SaslResponse
extends java.lang.Object

This class creates the SASL response that is to be returned to the client. This includes adding the ResourceOffering for the discovery service and creating the assertion that allows the user to access this service.

Author:
Gunn Olaussen & Kirsti N. Torgersen

Field Summary
private static java.lang.String AUTH_METHOD_PASSWORD
           
private  java.security.cert.X509Certificate cert
           
private static java.lang.String disco
           
private static java.lang.String ds
           
private  javax.xml.soap.SOAPEnvelope env
           
private  java.lang.String inResponseTo
           
private  java.lang.String issuerid
           
private static java.lang.String keystoreFile
           
private  javax.xml.soap.SOAPMessage message
           
private  ResourceOffering offering
           
private  java.security.PrivateKey privateKey
           
private static java.lang.String sa
           
private static java.lang.String saml
           
private static java.lang.String sb
           
private  java.lang.String serverMech
           
static java.lang.String STATUS_ABORT
           
static java.lang.String STATUS_CONTINUE
           
static java.lang.String STATUS_OK
           
private  java.lang.String statusCode
           
private static int TIME_TO_LIVE
           
 
Constructor Summary
SaslResponse(java.lang.String inResponseTo, java.lang.String statusCode, java.lang.String serverMech, ResourceOffering offering)
          The SaslRequest constructor.
 
Method Summary
private  void createBody()
          When creating the body the method adds the status element and an element which holds the content of the response.
private  void createHeaders()
          This method creates the header by adding all the required fields such as the correlation and timestamp.
private  void createSignature(javax.xml.soap.SOAPElement assertion)
          This method signs an authentication assertion without the signature element and adds the signature to the assertion.
private  void createToken(javax.xml.soap.SOAPElement saslResponse)
          This method creates an authentication assertion for the resource offering to the discovery service.
 javax.xml.soap.SOAPMessage getMessage()
           
private  void setStatusFailed()
          If the response encounters exceptions it will not be able to return a proper response.
 java.lang.String toString()
          Returns a String representation of the SOAP message containing this response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATUS_OK

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

STATUS_ABORT

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

STATUS_CONTINUE

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

disco

private static final java.lang.String disco
See Also:
Constant Field Values

saml

private static final java.lang.String saml
See Also:
Constant Field Values

ds

private static final java.lang.String ds
See Also:
Constant Field Values

sa

private static final java.lang.String sa
See Also:
Constant Field Values

sb

private static final java.lang.String sb
See Also:
Constant Field Values

TIME_TO_LIVE

private static final int TIME_TO_LIVE
See Also:
Constant Field Values

AUTH_METHOD_PASSWORD

private static final java.lang.String AUTH_METHOD_PASSWORD
See Also:
Constant Field Values

keystoreFile

private static final java.lang.String keystoreFile
See Also:
Constant Field Values

offering

private ResourceOffering offering

inResponseTo

private java.lang.String inResponseTo

message

private javax.xml.soap.SOAPMessage message

env

private javax.xml.soap.SOAPEnvelope env

statusCode

private java.lang.String statusCode

cert

private java.security.cert.X509Certificate cert

privateKey

private java.security.PrivateKey privateKey

issuerid

private java.lang.String issuerid

serverMech

private java.lang.String serverMech
Constructor Detail

SaslResponse

public SaslResponse(java.lang.String inResponseTo,
                    java.lang.String statusCode,
                    java.lang.String serverMech,
                    ResourceOffering offering)
The SaslRequest constructor. Initialises the member variables and starts the creation of the header and body elements.

Parameters:
inResponseTo - String The message identifier of the request this SASL response should respond to.
statusCode - String The status code of the response.
serverMech - String The SASL mechanism used to authenticate the user.
offering - ResourceOffering The resource offering for the discovery service.
Method Detail

setStatusFailed

private void setStatusFailed()
If the response encounters exceptions it will not be able to return a proper response. In these cases a response with the status code abort is returned instead. This method replaces the SaslResponse with a new SaslResponse with the status code abort.


createHeaders

private void createHeaders()
                    throws javax.xml.soap.SOAPException
This method creates the header by adding all the required fields such as the correlation and timestamp.

Throws:
javax.xml.soap.SOAPException

createBody

private void createBody()
                 throws javax.xml.soap.SOAPException,
                        java.security.GeneralSecurityException
When creating the body the method adds the status element and an element which holds the content of the response. If the status is OK, then methods to add the offering and token for the discovery service are called.

Throws:
javax.xml.soap.SOAPException
java.security.GeneralSecurityException

createToken

private void createToken(javax.xml.soap.SOAPElement saslResponse)
                  throws javax.xml.soap.SOAPException,
                         java.security.GeneralSecurityException
This method creates an authentication assertion for the resource offering to the discovery service.

Throws:
javax.xml.soap.SOAPException
java.security.GeneralSecurityException

createSignature

private void createSignature(javax.xml.soap.SOAPElement assertion)
                      throws javax.xml.soap.SOAPException,
                             java.security.GeneralSecurityException
This method signs an authentication assertion without the signature element and adds the signature to the assertion.

Throws:
javax.xml.soap.SOAPException
java.security.GeneralSecurityException

getMessage

public javax.xml.soap.SOAPMessage getMessage()
Returns:
SOAPMessage The SOAP message containing this response.

toString

public java.lang.String toString()
Returns a String representation of the SOAP message containing this response.

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()