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.saml2.metadata;
18  
19  import java.util.Collection;
20  import java.util.List;
21  
22  import javax.xml.namespace.QName;
23  
24  import org.opensaml.common.SignableSAMLObject;
25  import org.opensaml.common.xml.SAMLConstants;
26  import org.opensaml.saml2.common.CacheableSAMLObject;
27  import org.opensaml.saml2.common.Extensions;
28  import org.opensaml.saml2.common.TimeBoundSAMLObject;
29  import org.opensaml.xml.AttributeExtensibleXMLObject;
30  
31  /**
32   * SAML 2.0 Metadata RoleDescriptor.
33   */
34  public interface RoleDescriptor extends SignableSAMLObject, TimeBoundSAMLObject, CacheableSAMLObject,
35          AttributeExtensibleXMLObject {
36  
37      /** Element name, no namespace. */
38      public static final String DEFAULT_ELEMENT_LOCAL_NAME = "RoleDescriptor";
39      
40      /** Default element name. */
41      public static final QName DEFAULT_ELEMENT_NAME = new QName(SAMLConstants.SAML20MD_NS, DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX);
42      
43      /** Local name of the XSI type. */
44      public static final String TYPE_LOCAL_NAME = "RoleDescriptorType"; 
45          
46      /** QName of the XSI type. */
47      public static final QName TYPE_NAME = new QName(SAMLConstants.SAML20MD_NS, TYPE_LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX);
48  
49      /** "ID" attribute's local name. */
50      public static final String ID_ATTRIB_NAME = "ID";
51  
52      /** "protocolEnumeration" attribute's local name. */
53      public static final String PROTOCOL_ENUMERATION_ATTRIB_NAME = "protocolSupportEnumeration";
54  
55      /** "errorURL" attribute's local name. */
56      public static final String ERROR_URL_ATTRIB_NAME = "errorURL";
57  
58      /**
59       * Gets the ID of this role descriptor.
60       * 
61       * @return the ID of this role descriptor
62       */
63      public String getID();
64  
65      /**
66       * Sets the ID of this role descriptor.
67       * 
68       * @param newID the ID of this role descriptor
69       */
70      public void setID(String newID);
71  
72      /**
73       * Gets an immutable list of protocol URIs supported by this role.
74       * 
75       * @return list of protocol URIs supported by this role
76       */
77      public List<String> getSupportedProtocols();
78  
79      /**
80       * Chckes to see if the given protocol is supported by this role.
81       * 
82       * @param protocol the protocol
83       * 
84       * @return true if the protocol is supported, false if not
85       */
86      public boolean isSupportedProtocol(String protocol);
87  
88      /**
89       * Adds a protocol to the list of supported protocols for this role.
90       * 
91       * @param protocol the protocol
92       */
93      public void addSupportedProtocol(String protocol);
94  
95      /**
96       * Removes a protocol to the list of supported protocols for this role.
97       * 
98       * @param protocol the protocol
99       */
100     public void removeSupportedProtocol(String protocol);
101 
102     /**
103      * Removes a list of protocols to the list of supported protocols for this role.
104      * 
105      * @param protocols the protocol
106      */
107     public void removeSupportedProtocols(Collection<String> protocols);
108 
109     /**
110      * Removes all the supported protocols from this role.
111      * 
112      */
113     public void removeAllSupportedProtocols();
114 
115     /**
116      * Gets the URI users should be sent to in the event of an error.
117      * 
118      * @return the URI users should be sent to in the event of an error
119      */
120     public String getErrorURL();
121 
122     /**
123      * Sets the URI users should be sent to in the event of an error.
124      * 
125      * @param errorURL the URI users should be sent to in the event of an error
126      */
127     public void setErrorURL(String errorURL);
128 
129     /**
130      * Gets the Extensions child of this object.
131      * 
132      * @return the Extensions child of this object
133      */
134     public Extensions getExtensions();
135 
136     /**
137      * Sets the Extensions child of this object.
138      * 
139      * @param extensions the Extensions child of this object
140      * 
141      * @throws IllegalArgumentException thrown if the given extensions Object is already a child of another SAMLObject
142      */
143     public void setExtensions(Extensions extensions) throws IllegalArgumentException;
144 
145     /**
146      * Gets the key descriptors for this role.
147      * 
148      * @return the key descriptors for this role
149      */
150     public List<KeyDescriptor> getKeyDescriptors();
151 
152     /**
153      * Gets the organization responsible for this role.
154      * 
155      * @return the organization responsible for this role
156      */
157     public Organization getOrganization();
158 
159     /**
160      * Sets the organization responsible for this role.
161      * 
162      * @param organization the organization responsible for this role
163      * 
164      * @throws IllegalArgumentException thrown if the given organization is owned by another element
165      */
166     public void setOrganization(Organization organization) throws IllegalArgumentException;
167 
168     /**
169      * Gets an immutable list of {@link ContactPerson}s for this role.
170      * 
171      * @return list of {@link ContactPerson}s for this role
172      */
173     public List<ContactPerson> getContactPersons();
174     
175     /**
176      * Gets a read-only list of endpoints for this role.
177      * 
178      * @return immutable list of endpoints for this role
179      */
180     public List<Endpoint> getEndpoints();
181     
182     /**
183      * Gets a read-only list of endpoints for this role for the given type.
184      * 
185      * @param type the type of endpoints to retrieve
186      * 
187      * @return immutable list of endpoints for this role
188      */
189     public List<Endpoint> getEndpoints(QName type);
190 }