com.sun.identity.saml.assertion
Class Assertion

java.lang.Object
  |
  +--com.sun.identity.saml.assertion.Assertion

public class Assertion
extends java.lang.Object

This object stands for Assertion element.An Assertion is a package of information that supplies one or more Statement made by an issuer. There are three kinds of assertionsL Authentication, Authorization Decision and Attribute assertion.


Constructor Summary
Assertion(org.w3c.dom.Element assertionElement)
          This constructor is used to build Assertion object from a block of existing XML that has already been built into a DOM.
Assertion(java.lang.String assertionID, java.lang.String issuer, java.util.Date issueInstant, Conditions conditions, Advice advice, java.util.Set statements)
          This constructor is used to populate the data members:the assertionID, the issuer, time when assertion issued ,the conditions when creating a new assertion , Advice applicable to this Assertion and a Set of Statement(s) in the assertion.
Assertion(java.lang.String assertionID, java.lang.String issuer, java.util.Date issueInstant, Conditions conditions, java.util.Set statements)
          This constructor is used to populate the data members:the assertionID, the issuer, time when assertion issued ,the conditions when creating a new assertion and a Set of Statement(s) in the assertion.
Assertion(java.lang.String assertionID, java.lang.String issuer, java.util.Date issueInstant, java.util.Set statements)
          This constructor is used to populate the data members:the assertionID, the issuer, time when assertion issued and a Set of Statement (s) in the assertion.
 
Method Summary
 boolean addStatement(Statement statement)
          Add a statement to this Assertion
 Advice getAdvice()
          Get the advice of an assertion
 java.lang.String getAssertionID()
          Get the assertion id of an assertion
 Conditions getConditions()
          Get the conditions of an assertion
 java.util.Date getIssueInstant()
          Get the time when the assertion was issued
 java.lang.String getIssuer()
          Get the issuer of an assertion
 int getMajorVersion()
          Get the major version number of an assertion
 int getMinorVersion()
          Get the minor version number of an assertion
 org.w3c.dom.Element getSignature()
          Get the Signature element of the Assertion.
 java.util.Set getStatement()
          Get a Set of Statement contained within this assertion.
 boolean isSignatureValid()
          Return whether the signature on the object is valid or not.
 boolean isSigned()
          Return whether the object is signed or not.
 boolean isTimeValid()
          Gets the validity of the assertion evaluating its conditions if specified
 boolean setAdvice(Advice advice)
          Set the advice for an assertion
 boolean setConditions(Conditions conditions)
          Set the Conditions information for an assertion
 boolean setSignature(org.w3c.dom.Element elem)
          Set the signature for the Request
 void signXML()
          Sign the Assertion.
 java.lang.String toString()
          Create a String representation of the element
 java.lang.String toString(boolean includeNS, boolean declareNS)
          Create a String representation of the <Assertion> element
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Assertion

public Assertion(org.w3c.dom.Element assertionElement)
          throws SAMLException
This constructor is used to build Assertion object from a block of existing XML that has already been built into a DOM.
Parameters:
assertionElement: - A org.w3c.dom.Element>/code> representing DOM tree for Assertion object
Throws:
SAMLException - if it could not process the Element properly, implying that there is an error in the sender or in the element definition.

Assertion

public Assertion(java.lang.String assertionID,
                 java.lang.String issuer,
                 java.util.Date issueInstant,
                 java.util.Set statements)
          throws SAMLException
This constructor is used to populate the data members:the assertionID, the issuer, time when assertion issued and a Set of Statement (s) in the assertion.
Parameters:
assertionID: - assertionID attribute contained within this Assertion if null, an assertionID is generated internally.
issuer: - String representing the issuer of this assertion.
issueInstant: - time instant of the issue. It has type dateTime which is built in to the W3C XML Schema Types specification.if null, current time is used.
statements: - Set of Statement objects within this Assertion. It could be of type AuthenticationStatement , code>AuthorizationDecisionStatement and AttributeStatement. Each Assertion can have multiple type of statements in it.
Throws:
SAMLException - if there is an error in processing input.

Assertion

public Assertion(java.lang.String assertionID,
                 java.lang.String issuer,
                 java.util.Date issueInstant,
                 Conditions conditions,
                 java.util.Set statements)
          throws SAMLException
This constructor is used to populate the data members:the assertionID, the issuer, time when assertion issued ,the conditions when creating a new assertion and a Set of Statement(s) in the assertion.
Parameters:
assertionID: - String representing AssertionID contained within this Assertion if null its generated internally.
issuer: - String representing the issuer of this assertion.
issueInstant: - time instant of the issue. It has type dateTime which is built in to the W3C XML Schema Types specification. if null current time is used.
conditions: - Conditions under which the this Assertion is valid.
statements: - Set of Statement objects within this Assertion. It could be of type AuthenticationStatement , AuthorizationDecisionStatement and AttributeStatement. Each Assertion can have multiple type of statements in it.
Throws:
SAMLException - if there is an error in processing input.

Assertion

public Assertion(java.lang.String assertionID,
                 java.lang.String issuer,
                 java.util.Date issueInstant,
                 Conditions conditions,
                 Advice advice,
                 java.util.Set statements)
          throws SAMLException
This constructor is used to populate the data members:the assertionID, the issuer, time when assertion issued ,the conditions when creating a new assertion , Advice applicable to this Assertion and a Set of Statement(s) in the assertion.
Parameters:
assertionID: - AssertionID object contained within this Assertion if null its generated internally.
issuer: - String representing the issuer of this assertion.
issueInstant: - time instant of the issue. It has type dateTime which is built in to the W3C XML Schema Types specification. if null current time is used.
conditions: - Conditions under which the this Assertion is valid.
advice: - Advice applicale for this Assertion.
statements: - Set of Statement objects within this Assertion. It could be of type AuthenticationStatement , AuthorizationDecisionStatement and AttributeStatement. Each Assertion can have multiple type of statements in it.
Throws:
SAMLException - if there is an error in processing input.
Method Detail

isSigned

public boolean isSigned()
Return whether the object is signed or not.
Returns:
true if the object is signed; false otherwise.

isSignatureValid

public boolean isSignatureValid()
Return whether the signature on the object is valid or not.
Returns:
true if the signature on the object is valid; false otherwise.

signXML

public void signXML()
             throws SAMLException
Sign the Assertion.
Throws:
SAMLException - If it couldn't sign the Assertion.

getSignature

public org.w3c.dom.Element getSignature()
Get the Signature element of the Assertion.
Returns:
Element the Signature of the Assertion in DOM element.

setSignature

public boolean setSignature(org.w3c.dom.Element elem)
Set the signature for the Request
Parameters:
elem - ds:Signature element
Returns:
A boolean value: true if the operation succeeds; false otherwise.

isTimeValid

public boolean isTimeValid()
Gets the validity of the assertion evaluating its conditions if specified
Returns:
false if conditions is invalid based on it lying between NotBefore( current time inclusive) and NotOnOrAfter ( current time exclusive) values and true otherwise or if no conditions specified.

addStatement

public boolean addStatement(Statement statement)
Add a statement to this Assertion
Parameters:
statement: - Statement to be added
Returns:
boolean indicating success or failure of operation.

setAdvice

public boolean setAdvice(Advice advice)
Set the advice for an assertion
Parameters:
advice - : a linked list representing the advice information
Returns:
A boolean indicating the success of the operation.

setConditions

public boolean setConditions(Conditions conditions)
Set the Conditions information for an assertion
Parameters:
conditions - : a linked list representing the conditions information
Returns:
A boolean indicating the success of the operation.

getMajorVersion

public int getMajorVersion()
Get the major version number of an assertion
Returns:
The major version number of an assertion, as an int

getMinorVersion

public int getMinorVersion()
Get the minor version number of an assertion
Returns:
The minor version number of an assertion, as an int

getIssueInstant

public java.util.Date getIssueInstant()
Get the time when the assertion was issued
Returns:
The time in java.util.Date format

getIssuer

public java.lang.String getIssuer()
Get the issuer of an assertion
Returns:
The issuer of an assertion, as a string

getAssertionID

public java.lang.String getAssertionID()
Get the assertion id of an assertion
Returns:
String representing AssertionID of the assertion

getConditions

public Conditions getConditions()
Get the conditions of an assertion
Returns:
Conditions object containing conditions for an assertion being valid

getAdvice

public Advice getAdvice()
Get the advice of an assertion
Returns:
Advice object containing advice information of the assertion

getStatement

public java.util.Set getStatement()
Get a Set of Statement contained within this assertion.
Returns:
a java.util.Set

toString

public java.lang.String toString()
Create a String representation of the element
Overrides:
toString in class java.lang.Object
Returns:
A string containing the valid XML for this element By default name space name is prepended to the element name eg <saml:Assertion>

toString

public java.lang.String toString(boolean includeNS,
                                 boolean declareNS)
Create a String representation of the <Assertion> element
Parameters:
boolean - includeNS if true prepends all elements by their Namespace name eg <saml:Assertion>
boolean - declareNS if true includes the namespace within the generated XML.
Returns:
A string containing the valid XML for this element