View Javadoc

1   /*
2    * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.opensaml.saml1.core;
18  
19  import java.util.List;
20  
21  import javax.xml.namespace.QName;
22  
23  import org.joda.time.DateTime;
24  import org.opensaml.common.SAMLVersion;
25  import org.opensaml.common.SignableSAMLObject;
26  import org.opensaml.common.xml.SAMLConstants;
27  
28  /**
29   * This interface defines how the object representing a SAML 1 <code> Assertion </code> element behaves.
30   */
31  public interface Assertion extends SignableSAMLObject, Evidentiary {
32  
33      /** Element name, no namespace. */
34      public final static String DEFAULT_ELEMENT_LOCAL_NAME = "Assertion";
35      
36      /** Default element name */
37      public final static QName DEFAULT_ELEMENT_NAME = new QName(SAMLConstants.SAML1_NS, DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
38      
39      /** Local name of the XSI type */
40      public final static String TYPE_LOCAL_NAME = "AssertionType"; 
41          
42      /** QName of the XSI type */
43      public final static QName TYPE_NAME = new QName(SAMLConstants.SAML1_NS, TYPE_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
44  
45      /** Name for the attribute which defines Major Version (attribute's value must be 1) */
46      public final static String MAJORVERSION_ATTRIB_NAME = "MajorVersion";
47  
48      /** Name for the attribute which defines Minor Version. */
49      public final static String MINORVERSION_ATTRIB_NAME = "MinorVersion";
50  
51      /** Name for the attribute which defines Assertion ID */
52      public final static String ASSERTIONID_ATTRIB_NAME = "AssertionID";
53  
54      /** Name for the attribute which defines Issuer */
55      public final static String ISSUER_ATTRIB_NAME = "Issuer";
56  
57      /** Name for the attribute which defines the issue instant */
58      public final static String ISSUEINSTANT_ATTRIB_NAME = "IssueInstant";
59  
60      /** Name for the attribute which defines the Issue Instant. */
61      public final static String ID_ATTRIB_NAME = "AssertionID";
62  
63      /* attributes */
64  
65      /**
66       * Get the MajorVersion attribute.
67       * 
68       * @return The stored MajorVersion
69       */
70      public int getMajorVersion();
71      
72      /**
73       * Get the MinorVersion attribute.
74       * 
75       * @return The stored MinorVersion
76       */
77      public int getMinorVersion();
78      
79      /**
80       * Sets the SAML version of this assertion.
81       * 
82       * @param version the SAML version of this assertion
83       */
84      public void setVersion(SAMLVersion version);
85  
86      /**
87       * Get the Issuer (which is an attribute) .
88       * 
89       * @return the Issuer
90       */
91      public String getIssuer();
92  
93      /**
94       * Set the Issuer (attribute).
95       * 
96       * @param Issuer the value to set
97       */
98      public void setIssuer(String Issuer);
99  
100     /**
101      * Get the IssueInstant (attribute).
102      * 
103      * @return the Issue Instant (as a Date)
104      */
105     public DateTime getIssueInstant();
106 
107     /** Set the ID */
108     public String getID();
109     
110     /** Get the ID */
111     public void setID(String id);
112     
113     /**
114      * Set the IssueInstance (attribute).
115      * 
116      * @param issueInstant the issue instant value to set
117      */
118     public void setIssueInstant(DateTime issueInstant);
119 
120     /* Singleton Elements */
121 
122     /**
123      * Return the (singleton) Object, representing the <code> Conditions </code> sub element.
124      * 
125      * @return the Conditions object.
126      */
127     public Conditions getConditions();
128 
129     /**
130      * Set the Object representing the <code> Conditions </code> Sub element.
131      * 
132      * @param conditions the condition to List
133      * 
134      * @throws IllegalArgumentException if the condition has already been set into another object
135      */
136     public void setConditions(Conditions conditions) throws IllegalArgumentException;
137 
138     /**
139      * advice is a (singleton) Object, representing the <code> Advice </code> sub element
140      * 
141      * @return the advice object in this assertion
142      */
143     public Advice getAdvice();
144 
145     /**
146      * Set the Object representing the <code> Advice </code> sub element.
147      * 
148      * @param advice the object to set
149      * 
150      * @throws IllegalArgumentException if the object has already been put into another SAMLObject
151      */
152     public void setAdvice(Advice advice) throws IllegalArgumentException;
153 
154     /* Multiple Elements */
155 
156     /**
157      * Return the List representing all the <code> Statement </code> sub elements.
158      * 
159      * @return the List representing all the statements
160      */
161     public List<Statement> getStatements();
162 
163     /**
164      * Return the List representing all the <code> Statement </code> sub elements with a given schema type or element name.
165      * 
166      * @param typeOrName the schema type or element name
167      * 
168      * @return the List representing all the statements
169      */
170     public List<Statement> getStatements(QName typeOrName);
171 
172     /**
173      * Return the List representing all the <code> SubjectStatement </code> sub elements.
174      * 
175      * @return all the SubjectStatements
176      */
177     public List<SubjectStatement> getSubjectStatements();
178 
179     /**
180      * Return the List representing all the <code> AuthenticationStatement </code> sub elements.
181      * 
182      * @return all the AuthenticationStatements
183      */
184     public List<AuthenticationStatement> getAuthenticationStatements();
185 
186     /**
187      * Return the List representing all the <code> AuthorizationStatement </code> sub elements.
188      * 
189      * @return all the authorizationDecisionStatements.
190      */
191     public List<AuthorizationDecisionStatement> getAuthorizationDecisionStatements();
192 
193     /**
194      * Return all the <code> AttributeStatement </code> elements
195      * 
196      * @return all the attributeStatements
197      */
198     public List<AttributeStatement> getAttributeStatements();
199 }