001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
005 *
006 * The contents of this file are subject to the terms
007 * of the Common Development and Distribution License
008 * (the License). You may not use this file except in
009 * compliance with the License.
010 *
011 * You can obtain a copy of the License at
012 * https://opensso.dev.java.net/public/CDDLv1.0.html or
013 * opensso/legal/CDDLv1.0.txt
014 * See the License for the specific language governing
015 * permission and limitations under the License.
016 *
017 * When distributing Covered Code, include this CDDL
018 * Header Notice in each file and include the License file
019 * at opensso/legal/CDDLv1.0.txt.
020 * If applicable, add the following below the CDDL Header,
021 * with the fields enclosed by brackets [] replaced by
022 * your own identifying information:
023 * "Portions Copyrighted [year] [name of copyright owner]"
024 *
025 * $Id: Conditions.java,v 1.2 2008/06/25 05:47:41 qcheng Exp $
026 *
027 */
028
029
030package com.sun.identity.saml2.assertion;
031
032import java.util.Date;
033import java.util.List;
034import com.sun.identity.saml2.common.SAML2Exception;
035
036/**
037 * The <code>Conditions</code> defines the SAML constructs that place
038 * constraints on the acceptable use if SAML <code>Assertion</code>s.
039 * @supported.all.api
040 */
041public interface Conditions {
042
043    /**
044     * Returns the time instant at which the subject can no longer 
045     *    be confirmed. 
046     *
047     * @return the time instant at which the subject can no longer 
048     *    be confirmed.
049     */
050    public Date getNotOnOrAfter();
051
052    /**
053     * Sets the time instant at which the subject can no longer 
054     *    be confirmed. 
055     *
056     * @param value the time instant at which the subject can no longer
057     *    be confirmed.
058     * @exception SAML2Exception if the object is immutable
059     */
060    public void setNotOnOrAfter(Date value) throws SAML2Exception;
061
062    /** 
063     *  Returns a list of <code>Condition</code>
064     * 
065     *  @return a list of <code>Condition</code>
066     */
067    public List getConditions();
068 
069    /** 
070     *  Returns a list of <code>AudienceRestriction</code>
071     * 
072     *  @return a list of <code>AudienceRestriction</code>
073     */
074    public List getAudienceRestrictions();
075 
076    /** 
077     *  Returns a list of <code>OneTimeUse</code>
078     * 
079     *  @return a list of <code>OneTimeUse</code>
080     */
081    public List getOneTimeUses();
082 
083    /** 
084     *  Returns a list of <code>ProxyRestriction</code>  
085     * 
086     *  @return a list of <code>ProxyRestriction</code>
087     */
088    public List getProxyRestrictions();
089 
090    /** 
091     *  Sets a list of <code>Condition</code>
092     * 
093     *  @param conditions a list of <code>Condition</code>
094     *  @exception SAML2Exception if the object is immutable
095     */
096    public void setConditions(List conditions) throws SAML2Exception;
097 
098    /** 
099     *  Sets a list of <code>AudienceRestriction</code>
100     * 
101     *  @param ars a list of <code>AudienceRestriction</code>
102     *  @exception SAML2Exception if the object is immutable
103     */
104    public void setAudienceRestrictions(List ars) throws SAML2Exception;
105 
106    /** 
107     *  Sets a list of <code>OneTimeUse</code>
108     * 
109     *  @param oneTimeUses a list of <code>OneTimeUse</code>
110     *  @exception SAML2Exception if the object is immutable
111     */
112    public void setOneTimeUses(List oneTimeUses) throws SAML2Exception;
113 
114    /** 
115     *  Sets a list of <code>ProxyRestriction</code>  
116     * 
117     *  @param prs a list of <code>ProxyRestriction</code>
118     *  @exception SAML2Exception if the object is immutable
119     */
120    public void setProxyRestrictions(List prs) throws SAML2Exception;
121 
122    /**
123     * Returns the time instant before which the subject cannot be confirmed.
124     *
125     * @return the time instant before which the subject cannot be confirmed.
126     */
127    public Date getNotBefore();
128
129    /**
130     * Sets the time instant before which the subject cannot 
131     *     be confirmed.
132     *
133     * @param value the time instant before which the subject cannot 
134     *     be confirmed.
135     * @exception SAML2Exception if the object is immutable
136     */
137    public void setNotBefore(Date value) throws SAML2Exception;
138
139    /**
140     * Return true if a specific Date falls within the validity 
141     * interval of this set of conditions.
142     *
143     * @param someTime a time in milliseconds. 
144     * @return true if <code>someTime</code> is within the valid 
145     * interval of the <code>Conditions</code>.     
146     */
147    public boolean checkDateValidity(long someTime);
148
149   /**
150    * Returns a String representation
151    * @param includeNSPrefix Determines whether or not the namespace
152    *        qualifier is prepended to the Element when converted
153    * @param declareNS Determines whether or not the namespace is declared
154    *        within the Element.
155    * @return A String representation
156    * @exception SAML2Exception if something is wrong during conversion
157     */
158    public String toXMLString(boolean includeNSPrefix, boolean declareNS)
159     throws SAML2Exception;
160
161   /**
162    * Returns a String representation
163    *
164    * @return A String representation
165    * @exception SAML2Exception if something is wrong during conversion
166    */
167    public String toXMLString() throws SAML2Exception;
168
169   /**
170    * Makes the object immutable
171    */
172    public void makeImmutable();
173
174   /**
175    * Returns true if the object is mutable
176    *
177    * @return true if the object is mutable
178    */
179    public boolean isMutable();
180
181}