/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: Conditions.java,v 1.4 2008/06/25 05:47:32 qcheng Exp $
*
*/
/**
*This <code>Conditions</code> is a set of <code>Condition</code>.
*The validity of an <code>Assertion</code> MAY be subject to a set of
*<code>Conditions</code>. Each <code>Condition</code> evaluates to a value
*that is Valid, Invalid or Indeterminate.
*
*@supported.all.api
*/
public class Conditions {
/**
A Set containing all the AudienceRestrictionCondition elements for this
<code>Conditions</code> object
*/
/**
* Default Constructor
*/
public Conditions() {}
/**
* Constructs an instance of <code>Conditions</code>.
*
* @param notBefore specifies the earliest time instant at which the
* assertion is valid.
* @param notOnOrAfter specifies the time instant at which the assertion
* has expired.
* @exception SAMLException if the <code>notBefore</code> instant is after
* <code>notOnOrAfter</code> instant.
*/
throws SAMLException
{
if(notOnOrAfter != null) {
{
+ " notBefore or notOnOrAfter");
}
throw new SAMLRequesterException(
} else {
}
} else {
}
} else {
}
}
/**
* Constructs an instance of <code>Conditions</code>.
*
* @param notBefore specifies the earliest time instant at which the
* assertion is valid.
* @param notOnOrAfter specifies the time instant at which the assertion
* has expired.
* @param condition <code>Condition</code> object
* @param arc the <code><AudienceRestrictionCondition></code> to be
* added.Can be null, if no audience restriction.
* @exception SAMLException if there is a problem in input data and it
* cannot be processed correctly.
*/
throws SAMLException
{
{
}
throw new SAMLRequesterException(
}
}
}
}
/**
* Constructs an instance of <code>Conditions</code>.
*
* @param notBefore specifies the earliest time instant at which the
* assertion is valid.
* @param notOnOrAfter specifies the time instant at which the assertion
* has expired.
* @param condition <code>Condition</code> object
* @param arc the <code><AudienceRestrictionCondition></code> to be
* added. Can be null, if no audience restriction.
* @param doNotCacheCnd <code>DoNotCacheCondition</code> object
* @exception SAMLException if there is a problem in input data and it
* cannot be processed correctly.
*/
throws SAMLException
{
if (doNotCacheCnd != null) {
}
}
/**
* Constructs a <code>Conditions</code> element from an existing XML block.
*
* @param conditionsElement A <code>org.w3c.dom.Element</code> representing
* DOM tree for <code>Conditions</code> object
* @exception SAMLException if it could not process the Element properly,
* implying that there is an error in the sender or in the
* element definition.
*/
throws SAMLException
{
}
("nullInput")) ;
}
"Conditions: invalid root element");
}
throw new SAMLRequesterException(
}
try {
} catch (ParseException pe) {
"Conditions: could not parse "
+ "NotBefore or NotOnOrAfter ");
}
throw new SAMLRequesterException(
}
}
try {
} catch (ParseException pe) {
"parse NotBefore or NotOnOrAfter ");
}
throw new SAMLRequesterException(
pe.getMessage());
}
}
for (int n=0; n<length; n++) {
continue;
}
} else {
// may be extension type defined by xsi:type
} else {
+ "condition, cannot determine extension ");
}
throw new SAMLRequesterException(
"unsupportedCondition"));
}
}
}
}
/**
* Returns the earliest time at which the assertion is valid held in this
* <code>Conditions</code> object.
*
* @return A Date containing the <code>NotBefore</code> time held within
* this <code>Conditions</code> element.
*/
return _notBefore;
}
/**
* Returns the time instant held within this <code>Conditions</code> object
* at which the <code>Assertion</code> has expired.
*
* @return time instant (at which assertion has expired) held within this
* <code>Conditions</code> element.
*/
return _notOnOrAfter;
}
/**
* Adds an audience restriction condition within this
* <code>Conditions</code> Element.
*
* @param arc a <code>AudienceRestrictionCondition</code> to be added to
* this <code>Conditions</code>.
* @return true if the operation succeeds.
*/
public boolean addAudienceRestrictionCondition(
{
return true;
} else {
return false;
}
}
/**
* Returns true if a specific Date falls within the validity interval of
* this set of conditions.
*
* @param someTime Any time in milliseconds.
* @return true if <code>someDate</code> is within the valid interval of the
* <code>Conditions</code>.
*/
if (_notBefore == null ) {
if (_notOnOrAfter == null) {
return true;
} else {
return true;
}
}
} else if (_notOnOrAfter == null ) {
return true;
}
{
return true;
}
return false;
}
/**
* Returns a set of the <code>AudienceRestrictionCondition</code> elements
* held within this <code>Conditions</code> element.
*
* @return A set of the audience restriction conditions. Each element
* contained within is an object of
* <code>AudienceRestrictionCondition</code> type.
*/
return _arcs;
}
/**
* Removes an audience restriction condition
* <code>AudienceRestrictionCondition</code>from this
* <code>Conditions</code> object wherein the specified audience has been
* defined.
*
* @param audience A string representing audience.
* @return true if the operation succeeds.
*/
}
}
return false;
}
/**
* Sets <code>DoNotCacheCondition</code> elements held within this
* <code>Conditions</code> element.
*
* @param doNotCacheCnd an <code>DoNotCacheCondition</code> object.
*/
if (doNotCacheCnd != null) {
}
}
/**
* Returns <code>DoNotCacheCondition</code> elements held within this
* <code>Conditions</code> element
*
* @return an <code>DoNotCacheCondition</code> object if Conditions contains
* any <code>DoNotCacheCondition</code>, otherwise return null.
*/
return doNotCache;
}
/**
* Returns a String representation of the element.
*
* @return A string containing the valid XML for this element
* By default name space name is prepended to the element name
* example <code><saml:Conditions></code>.
*/
// call toString() with includeNS true by default and declareNS false
return xml;
}
/**
* Returns a String representation of the <code><Conditions></code>
* element.
*
* @param includeNS Determines whether or not the namespace qualifier is
* prepended to the Element when converted
* @param declareNS Determines whether or not the namespace is declared
* within the Element.
* @return A string containing the valid XML for this element.
*/
if (_notBefore != null) {
.append("=\"")
.append("\"")
.append(" ");
}
if (_notOnOrAfter != null) {
.append("=\"")
.append("\"")
.append(" ");
}
// false above as we dont want to have nested multiple
// declarations of namespace
}
}
if (doNotCache != null) {
}
}
protected AudienceRestrictionCondition
throws SAMLException {
return new AudienceRestrictionCondition(audienceRestrictionElement);
}
protected DoNotCacheCondition
throws SAMLException {
return new DoNotCacheCondition(doNotCacheConditionElement);
}
}