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 * Portions Copyrighted 2015 ForgeRock AS.
028 */
029
030package com.sun.identity.saml2.assertion;
031
032import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
033import com.sun.identity.saml2.assertion.impl.ConditionsImpl;
034import com.sun.identity.saml2.common.SAML2Exception;
035import java.util.Date;
036import java.util.List;
037
038/**
039 * The <code>Conditions</code> defines the SAML constructs that place
040 * constraints on the acceptable use if SAML <code>Assertion</code>s.
041 * @supported.all.api
042 */
043@JsonDeserialize(as=ConditionsImpl.class)
044public interface Conditions {
045
046    /**
047     * Returns the time instant at which the subject can no longer 
048     *    be confirmed. 
049     *
050     * @return the time instant at which the subject can no longer 
051     *    be confirmed.
052     */
053    public Date getNotOnOrAfter();
054
055    /**
056     * Sets the time instant at which the subject can no longer 
057     *    be confirmed. 
058     *
059     * @param value the time instant at which the subject can no longer
060     *    be confirmed.
061     * @exception SAML2Exception if the object is immutable
062     */
063    public void setNotOnOrAfter(Date value) throws SAML2Exception;
064
065    /** 
066     *  Returns a list of <code>Condition</code>
067     * 
068     *  @return a list of <code>Condition</code>
069     */
070    public List getConditions();
071 
072    /** 
073     *  Returns a list of <code>AudienceRestriction</code>
074     * 
075     *  @return a list of <code>AudienceRestriction</code>
076     */
077    public List getAudienceRestrictions();
078 
079    /** 
080     *  Returns a list of <code>OneTimeUse</code>
081     * 
082     *  @return a list of <code>OneTimeUse</code>
083     */
084    public List getOneTimeUses();
085 
086    /** 
087     *  Returns a list of <code>ProxyRestriction</code>  
088     * 
089     *  @return a list of <code>ProxyRestriction</code>
090     */
091    public List getProxyRestrictions();
092 
093    /** 
094     *  Sets a list of <code>Condition</code>
095     * 
096     *  @param conditions a list of <code>Condition</code>
097     *  @exception SAML2Exception if the object is immutable
098     */
099    public void setConditions(List conditions) throws SAML2Exception;
100 
101    /** 
102     *  Sets a list of <code>AudienceRestriction</code>
103     * 
104     *  @param ars a list of <code>AudienceRestriction</code>
105     *  @exception SAML2Exception if the object is immutable
106     */
107    public void setAudienceRestrictions(List ars) throws SAML2Exception;
108 
109    /** 
110     *  Sets a list of <code>OneTimeUse</code>
111     * 
112     *  @param oneTimeUses a list of <code>OneTimeUse</code>
113     *  @exception SAML2Exception if the object is immutable
114     */
115    public void setOneTimeUses(List oneTimeUses) throws SAML2Exception;
116 
117    /** 
118     *  Sets a list of <code>ProxyRestriction</code>  
119     * 
120     *  @param prs a list of <code>ProxyRestriction</code>
121     *  @exception SAML2Exception if the object is immutable
122     */
123    public void setProxyRestrictions(List prs) throws SAML2Exception;
124 
125    /**
126     * Returns the time instant before which the subject cannot be confirmed.
127     *
128     * @return the time instant before which the subject cannot be confirmed.
129     */
130    public Date getNotBefore();
131
132    /**
133     * Sets the time instant before which the subject cannot 
134     *     be confirmed.
135     *
136     * @param value the time instant before which the subject cannot 
137     *     be confirmed.
138     * @exception SAML2Exception if the object is immutable
139     */
140    public void setNotBefore(Date value) throws SAML2Exception;
141
142    /**
143     * Return true if a specific Date falls within the validity 
144     * interval of this set of conditions.
145     *
146     * @param someTime a time in milliseconds. 
147     * @return true if <code>someTime</code> is within the valid 
148     * interval of the <code>Conditions</code>.     
149     */
150    public boolean checkDateValidity(long someTime);
151
152   /**
153    * Returns a String representation
154    * @param includeNSPrefix Determines whether or not the namespace
155    *        qualifier is prepended to the Element when converted
156    * @param declareNS Determines whether or not the namespace is declared
157    *        within the Element.
158    * @return A String representation
159    * @exception SAML2Exception if something is wrong during conversion
160     */
161    public String toXMLString(boolean includeNSPrefix, boolean declareNS)
162     throws SAML2Exception;
163
164   /**
165    * Returns a String representation
166    *
167    * @return A String representation
168    * @exception SAML2Exception if something is wrong during conversion
169    */
170    public String toXMLString() throws SAML2Exception;
171
172   /**
173    * Makes the object immutable
174    */
175    public void makeImmutable();
176
177   /**
178    * Returns true if the object is mutable
179    *
180    * @return true if the object is mutable
181    */
182    public boolean isMutable();
183
184}