com.sun.identity.saml.assertion
Class Conditions

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

public class Conditions
extends java.lang.Object

The validity of an Assertion MAY be subject to a set of Conditions. Each Condition evaluates to a value that is Valid, Invalid or Indeterminate.


Constructor Summary
Conditions()
          Constructor taking in nothing (SAML spec allows it)
Conditions(java.util.Date notBefore, java.util.Date notOnOrAfter)
          Constructs an instance of Conditions.
Conditions(java.util.Date notBefore, java.util.Date notOnOrAfter, Condition condition, AudienceRestrictionCondition arc)
          Constructs an instance of Conditions.
Conditions(java.util.Date notBefore, java.util.Date notOnOrAfter, Condition condition, AudienceRestrictionCondition arc, DoNotCacheCondition doNotCacheCnd)
          Constructs an instance of Conditions.
Conditions(org.w3c.dom.Element conditionsElement)
          Constructs a Conditions element from an existing XML block.
 
Method Summary
 boolean addAudienceRestrictionCondition(AudienceRestrictionCondition arc)
          Adds an audience restriction condition within this Conditions Element.
 boolean checkDateValidity(long someTime)
          Return true if a specific Date falls within the validity interval of this set of conditions.
 java.util.Set getAudienceRestrictionCondition()
          Returns a set of the AudienceRestrictionCondition elements held within this Conditions element.
 DoNotCacheCondition getDoNotCacheCondition()
          Returns DoNotCacheCondition elements held within this Conditions element
 java.util.Date getNotBefore()
          Returns the earliest time at which the assertion is valid held in this Conditions object.
 java.util.Date getNotOnorAfter()
          Returns the time instant held within this Conditions object at which the Assertion has expired.
 boolean removeAudienceRestrictionCondition(java.lang.String audience)
          Removes an audience restriction condition AudienceRestrictionConditionfrom this Conditions object wherein the specified audience has been defined.
 void setDoNotCacheCondition(DoNotCacheCondition doNotCacheCnd)
          Set DoNotCacheCondition elements held within this Conditions element.
 java.lang.String toString()
          Returns a String representation of the element.
 java.lang.String toString(boolean includeNS, boolean declareNS)
          Returns a String representation of the <Conditions> element.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Conditions

public Conditions()
Constructor taking in nothing (SAML spec allows it)

Conditions

public Conditions(java.util.Date notBefore,
                  java.util.Date notOnOrAfter)
           throws SAMLException
Constructs an instance of Conditions.
Parameters:
notBefore - specifies the earliest time instant at which the assertion is valid.
notOnOrAfter - specifies the time instant at which the assertion has expired.
Throws:
SAMLException - if the notBefore instant is after notOnOrAfter instant.

Conditions

public Conditions(java.util.Date notBefore,
                  java.util.Date notOnOrAfter,
                  Condition condition,
                  AudienceRestrictionCondition arc)
           throws SAMLException
Constructs an instance of Conditions.
Parameters:
notBefore - specifies the earliest time instant at which the assertion is valid.
notOnOrAfter - specifies the time instant at which the assertion has expired.
condition - Condition object
arc - the <AudienceRestrictionCondition> to be added.Can be null, if no audience restriction.
Throws:
SAMLException - if there is a problem in input data and it cannot be processed correctly.

Conditions

public Conditions(java.util.Date notBefore,
                  java.util.Date notOnOrAfter,
                  Condition condition,
                  AudienceRestrictionCondition arc,
                  DoNotCacheCondition doNotCacheCnd)
           throws SAMLException
Constructs an instance of Conditions.
Parameters:
notBefore - specifies the earliest time instant at which the assertion is valid.
notOnOrAfter - specifies the time instant at which the assertion has expired.
condition - Condition object
arc - the <AudienceRestrictionCondition> to be added. Can be null, if no audience restriction.
doNotCacheCnd - DoNotCacheCondition object
Throws:
SAMLException - if there is a problem in input data and it cannot be processed correctly.

Conditions

public Conditions(org.w3c.dom.Element conditionsElement)
           throws SAMLException
Constructs a Conditions element from an existing XML block.
Parameters:
conditionsElement - A org.w3c.dom.Element representing DOM tree for Conditions 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.
Method Detail

getNotBefore

public java.util.Date getNotBefore()
Returns the earliest time at which the assertion is valid held in this Conditions object.
Returns:
A Date containing the NotBefore time held within this Conditions element.

getNotOnorAfter

public java.util.Date getNotOnorAfter()
Returns the time instant held within this Conditions object at which the Assertion has expired.
Returns:
time instant (at which assertion has expired) held within this Conditions element.

addAudienceRestrictionCondition

public boolean addAudienceRestrictionCondition(AudienceRestrictionCondition arc)
Adds an audience restriction condition within this Conditions Element.
Parameters:
arc - a AudienceRestrictionCondition to be added to this Conditions.
Returns:
true if the operation succeeds.

checkDateValidity

public boolean checkDateValidity(long someTime)
Return true if a specific Date falls within the validity interval of this set of conditions.
Parameters:
someTime - Any time in milliseconds.
Returns:
true if someDate is within the valid interval of the Conditions.

getAudienceRestrictionCondition

public java.util.Set getAudienceRestrictionCondition()
Returns a set of the AudienceRestrictionCondition elements held within this Conditions element.
Returns:
A set of the audience restriction conditions. Each element contained within is an object of AudienceRestrictionCondition type.

removeAudienceRestrictionCondition

public boolean removeAudienceRestrictionCondition(java.lang.String audience)
Removes an audience restriction condition AudienceRestrictionConditionfrom this Conditions object wherein the specified audience has been defined.
Parameters:
audience - A string representing audience.
Returns:
true if the operation succeeds.

setDoNotCacheCondition

public void setDoNotCacheCondition(DoNotCacheCondition doNotCacheCnd)
Set DoNotCacheCondition elements held within this Conditions element.
Parameters:
doNotCacheCnd - an DoNotCacheCondition object.

getDoNotCacheCondition

public DoNotCacheCondition getDoNotCacheCondition()
Returns DoNotCacheCondition elements held within this Conditions element
Returns:
an DoNotCacheCondition object if Conditions contains any DoNotCacheCondition, otherwise return null.

toString

public java.lang.String toString()
Returns 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 example <saml:Conditions>.

toString

public java.lang.String toString(boolean includeNS,
                                 boolean declareNS)
Returns a String representation of the <Conditions> element.
Parameters:
includeNS - Determines whether or not the namespace qualifier is prepended to the Element when converted
declareNS - Determines whether or not the namespace is declared within the Element.
Returns:
A string containing the valid XML for this element.


Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.