discovery
Class DiscoQuery

java.lang.Object
  extended by discovery.DiscoQuery

public class DiscoQuery
extends java.lang.Object

The DiscoQuery is used to parse the request and save the information that we need to verify the validity of the message and to find the information needed in the response.

Author:
Gunn Olaussen & Kirsti N. Torgersen

Field Summary
private  org.w3c.dom.Node authenticationAssertion
           
private  org.w3c.dom.Node authenticationAssertionCopy
           
private  java.lang.String authenticationIssuer
           
private static long MAX_TIME_DEVIATION
           
private  javax.xml.soap.SOAPMessage message
           
private  java.lang.String messageid
           
private  java.lang.String reqServiceType
           
private  java.lang.String resourceid
           
private static long SESSION_TIME_TO_LIVE
           
private  java.util.Date sessiontimeout
           
private  java.util.Date timestamp
           
private  java.lang.String userid
           
 
Constructor Summary
DiscoQuery(javax.xml.soap.SOAPMessage message)
          The constructor tries to parse the body and the header of the SOAP message.
 
Method Summary
 org.w3c.dom.Node getAuthenticationAssertion()
           
 java.lang.String getMessageID()
           
 java.lang.String getReqServiceType()
           
 java.lang.String getResourceID()
           
 java.util.Date getTimestamp()
           
 java.lang.String getUserID()
           
private  void parseBody(org.w3c.dom.Node node)
          This method runs through all the nodes in the request body to find the nodes we need, which are the service type and the resourceID.
private  void parseHead(javax.xml.soap.SOAPHeader node)
          This method runs through all the nodes in the request body to find the nodes we need, which are the timestamp and the message token.
private  java.lang.String prepareAssertion(java.lang.String assertion)
          This method removes extra spaces, line breaks and the signature element to make the assertion similar at all times when using it for signing and signature verification.
private  void processSecToken(org.w3c.dom.Node token, int parsingDepth)
          This method processes the security token to find if the assertion from the authentication service is correct.
 boolean sessionTimedOut()
           
 java.lang.String toString()
          Returns a string representation of this request.
private  void validateSignature(org.w3c.dom.Node signaturenode)
          This method validates the signature and throws an Exception if there is something wrong, to indicate that an invalid assertion and that we should not proceed with creating a response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_TIME_DEVIATION

private static final long MAX_TIME_DEVIATION
See Also:
Constant Field Values

SESSION_TIME_TO_LIVE

private static final long SESSION_TIME_TO_LIVE
See Also:
Constant Field Values

sessiontimeout

private java.util.Date sessiontimeout

timestamp

private java.util.Date timestamp

authenticationAssertion

private org.w3c.dom.Node authenticationAssertion

authenticationAssertionCopy

private org.w3c.dom.Node authenticationAssertionCopy

messageid

private java.lang.String messageid

resourceid

private java.lang.String resourceid

userid

private java.lang.String userid

reqServiceType

private java.lang.String reqServiceType

authenticationIssuer

private java.lang.String authenticationIssuer

message

private javax.xml.soap.SOAPMessage message
Constructor Detail

DiscoQuery

public DiscoQuery(javax.xml.soap.SOAPMessage message)
           throws java.lang.Exception
The constructor tries to parse the body and the header of the SOAP message.

Parameters:
message - SOAPMessage The SOAPMessage containing the request
Throws:
java.lang.Exception - Thrown to show that the request parsing was unsuccessful
Method Detail

parseBody

private void parseBody(org.w3c.dom.Node node)
This method runs through all the nodes in the request body to find the nodes we need, which are the service type and the resourceID.


parseHead

private void parseHead(javax.xml.soap.SOAPHeader node)
                throws java.lang.Exception
This method runs through all the nodes in the request body to find the nodes we need, which are the timestamp and the message token. The security token is checked in a separate method.

Throws:
java.lang.Exception

processSecToken

private void processSecToken(org.w3c.dom.Node token,
                             int parsingDepth)
                      throws java.lang.Exception
This method processes the security token to find if the assertion from the authentication service is correct. It uses a separate method to validate the signature on the assertion.

Throws:
java.lang.Exception

prepareAssertion

private java.lang.String prepareAssertion(java.lang.String assertion)
This method removes extra spaces, line breaks and the signature element to make the assertion similar at all times when using it for signing and signature verification.


validateSignature

private void validateSignature(org.w3c.dom.Node signaturenode)
                        throws java.lang.Exception
This method validates the signature and throws an Exception if there is something wrong, to indicate that an invalid assertion and that we should not proceed with creating a response.

Throws:
java.lang.Exception

getUserID

public java.lang.String getUserID()
Returns:
String Returns the userID.

getResourceID

public java.lang.String getResourceID()
Returns:
String Returns the resourceID.

getMessageID

public java.lang.String getMessageID()
Returns:
String Returns the messageID

getTimestamp

public java.util.Date getTimestamp()
Returns:
Date Returns the timestamp of the message.

getReqServiceType

public java.lang.String getReqServiceType()
Returns:
String Returns the service type identified in the request.

getAuthenticationAssertion

public org.w3c.dom.Node getAuthenticationAssertion()
Returns:
Node Returns the assertion from the authentication service which was enclosed in the request.

sessionTimedOut

public boolean sessionTimedOut()
Returns:
boolean Returns true if the session has timed out and false if not.

toString

public java.lang.String toString()
Returns a string representation of this request.

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