Package com.sun.identity.saml.assertion
Class Conditions
- java.lang.Object
-
- com.sun.identity.saml.assertion.Conditions
-
public class Conditions extends Object
ThisConditionsis a set ofCondition. The validity of anAssertionMAY be subject to a set ofConditions. EachConditionevaluates to a value that is Valid, Invalid or Indeterminate.
-
-
Field Summary
Fields Modifier and Type Field Description protected DoNotCacheConditiondoNotCache
-
Constructor Summary
Constructors Constructor Description Conditions()Default ConstructorConditions(Date notBefore, Date notOnOrAfter)Constructs an instance ofConditions.Conditions(Date notBefore, Date notOnOrAfter, Condition condition, AudienceRestrictionCondition arc)Constructs an instance ofConditions.Conditions(Date notBefore, Date notOnOrAfter, Condition condition, AudienceRestrictionCondition arc, DoNotCacheCondition doNotCacheCnd)Constructs an instance ofConditions.Conditions(Element conditionsElement)Constructs aConditionselement from an existing XML block.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddAudienceRestrictionCondition(AudienceRestrictionCondition arc)Adds an audience restriction condition within thisConditionsElement.booleancheckDateValidity(long someTime)Returns true if a specific Date falls within the validity interval of this set of conditions.protected AudienceRestrictionConditioncreateAudienceRestrictionCondition(Element audienceRestrictionElement)protected DoNotCacheConditioncreateDoNotCacheCondition(Element doNotCacheConditionElement)SetgetAudienceRestrictionCondition()Returns a set of theAudienceRestrictionConditionelements held within thisConditionselement.DoNotCacheConditiongetDoNotCacheCondition()ReturnsDoNotCacheConditionelements held within thisConditionselementDategetNotBefore()Returns the earliest time at which the assertion is valid held in thisConditionsobject.DategetNotOnorAfter()Returns the time instant held within thisConditionsobject at which theAssertionhas expired.booleanremoveAudienceRestrictionCondition(String audience)Removes an audience restriction conditionAudienceRestrictionConditionfrom thisConditionsobject wherein the specified audience has been defined.voidsetDoNotCacheCondition(DoNotCacheCondition doNotCacheCnd)SetsDoNotCacheConditionelements held within thisConditionselement.StringtoString()Returns a String representation of the element.StringtoString(boolean includeNS, boolean declareNS)Returns a String representation of the<Conditions>element.
-
-
-
Field Detail
-
doNotCache
protected DoNotCacheCondition doNotCache
-
-
Constructor Detail
-
Conditions
public Conditions()
Default Constructor
-
Conditions
public Conditions(Date notBefore, Date notOnOrAfter) throws SAMLException
Constructs an instance ofConditions.- 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 thenotBeforeinstant is afternotOnOrAfterinstant.
-
Conditions
public Conditions(Date notBefore, Date notOnOrAfter, Condition condition, AudienceRestrictionCondition arc) throws SAMLException
Constructs an instance ofConditions.- 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-Conditionobjectarc- 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(Date notBefore, Date notOnOrAfter, Condition condition, AudienceRestrictionCondition arc, DoNotCacheCondition doNotCacheCnd) throws SAMLException
Constructs an instance ofConditions.- 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-Conditionobjectarc- the<AudienceRestrictionCondition>to be added. Can be null, if no audience restriction.doNotCacheCnd-DoNotCacheConditionobject- Throws:
SAMLException- if there is a problem in input data and it cannot be processed correctly.
-
Conditions
public Conditions(Element conditionsElement) throws SAMLException
Constructs aConditionselement from an existing XML block.- Parameters:
conditionsElement- Aorg.w3c.dom.Elementrepresenting DOM tree forConditionsobject- 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 Date getNotBefore()
Returns the earliest time at which the assertion is valid held in thisConditionsobject.- Returns:
- A Date containing the
NotBeforetime held within thisConditionselement.
-
getNotOnorAfter
public Date getNotOnorAfter()
Returns the time instant held within thisConditionsobject at which theAssertionhas expired.- Returns:
- time instant (at which assertion has expired) held within this
Conditionselement.
-
addAudienceRestrictionCondition
public boolean addAudienceRestrictionCondition(AudienceRestrictionCondition arc)
Adds an audience restriction condition within thisConditionsElement.- Parameters:
arc- aAudienceRestrictionConditionto be added to thisConditions.- Returns:
- true if the operation succeeds.
-
checkDateValidity
public boolean checkDateValidity(long someTime)
Returns true if a specific Date falls within the validity interval of this set of conditions.- Parameters:
someTime- Any time in milliseconds.- Returns:
- true if
someDateis within the valid interval of theConditions.
-
getAudienceRestrictionCondition
public Set getAudienceRestrictionCondition()
Returns a set of theAudienceRestrictionConditionelements held within thisConditionselement.- Returns:
- A set of the audience restriction conditions. Each element
contained within is an object of
AudienceRestrictionConditiontype.
-
removeAudienceRestrictionCondition
public boolean removeAudienceRestrictionCondition(String audience)
Removes an audience restriction conditionAudienceRestrictionConditionfrom thisConditionsobject 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)
SetsDoNotCacheConditionelements held within thisConditionselement.- Parameters:
doNotCacheCnd- anDoNotCacheConditionobject.
-
getDoNotCacheCondition
public DoNotCacheCondition getDoNotCacheCondition()
ReturnsDoNotCacheConditionelements held within thisConditionselement- Returns:
- an
DoNotCacheConditionobject if Conditions contains anyDoNotCacheCondition, otherwise return null.
-
toString
public String toString()
Returns a String representation of the element.
-
toString
public 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 converteddeclareNS- Determines whether or not the namespace is declared within the Element.- Returns:
- A string containing the valid XML for this element.
-
createAudienceRestrictionCondition
protected AudienceRestrictionCondition createAudienceRestrictionCondition(Element audienceRestrictionElement) throws SAMLException
- Throws:
SAMLException
-
createDoNotCacheCondition
protected DoNotCacheCondition createDoNotCacheCondition(Element doNotCacheConditionElement) throws SAMLException
- Throws:
SAMLException
-
-