View Javadoc

1   /*
2    * Copyright [2007] [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.common.binding;
18  
19  import javax.xml.namespace.QName;
20  
21  import org.joda.time.DateTime;
22  import org.opensaml.common.SAMLObject;
23  import org.opensaml.saml2.metadata.Endpoint;
24  import org.opensaml.saml2.metadata.EntityDescriptor;
25  import org.opensaml.saml2.metadata.RoleDescriptor;
26  import org.opensaml.saml2.metadata.provider.MetadataProvider;
27  import org.opensaml.ws.message.MessageContext;
28  import org.opensaml.xml.security.credential.Credential;
29  
30  /**
31   * SAML specific extension to the more basic {@link MessageContext}.
32   * 
33   * @param <InboundMessageType> type of inbound SAML message
34   * @param <OutboundMessageType> type of outbound SAML message
35   * @param <NameIdentifierType> type of name identifier used for subjects
36   */
37  public interface SAMLMessageContext<InboundMessageType extends SAMLObject, OutboundMessageType extends SAMLObject, NameIdentifierType extends SAMLObject>
38          extends MessageContext {
39  
40      /**
41       * Gets the inbound SAML message. This may not be the same as the message returned from
42       * {@link MessageContext#getInboundMessage()} if the SAML message was carried in another protocol (e.g. SOAP).
43       * 
44       * @return inbound SAML message
45       */
46      public InboundMessageType getInboundSAMLMessage();
47  
48      /**
49       * Gets the ID of the inbound SAML message.
50       * 
51       * @return ID of the inbound SAML message
52       */
53      public String getInboundSAMLMessageId();
54  
55      /**
56       * Gets the issue instant of the incomming SAML message.
57       * 
58       * @return issue instant of the incomming SAML message
59       */
60      public DateTime getInboundSAMLMessageIssueInstant();
61  
62      /**
63       * Gets the protocol used by the peer entity to communicate with the local entity.
64       * 
65       * @return protocol used by the peer entity to communicate with the local entity
66       */
67      public String getInboundSAMLProtocol();
68  
69      /**
70       * Gets the local entity's ID.
71       * 
72       * @return local entity's ID
73       */
74      public String getLocalEntityId();
75  
76      /**
77       * Gets the local entity metadata.
78       * 
79       * @return local entity metadata
80       */
81      public EntityDescriptor getLocalEntityMetadata();
82  
83      /**
84       * Gets the role of the local entity.
85       * 
86       * @return role of the local entity
87       */
88      public QName getLocalEntityRole();
89      
90      /**
91       * Gets the role metadata of the local entity.
92       * 
93       * @return role metadata of the local entity
94       */
95      public RoleDescriptor getLocalEntityRoleMetadata();
96  
97      /**
98       * Gets the metadata provider used to lookup information entity information.
99       * 
100      * @return metadata provider used to lookup information entity information
101      */
102     public MetadataProvider getMetadataProvider();
103 
104     /**
105      * Gets the credential used to sign the outbound SAML message.
106      * 
107      * @return credential used to sign the outbound SAML message
108      */
109     public Credential getOuboundSAMLMessageSigningCredential();
110 
111     /**
112      * Gets the artifact type to use for the outbound message.
113      * 
114      * @return artifact type to use for the outbound message
115      */
116     public byte[] getOutboundMessageArtifactType();
117 
118     /**
119      * Gets the outbound SAML message. This may not be the same as the message returned from
120      * {@link MessageContext#getOutboundMessage()} if the SAML message was carried in another protocol (e.g. SOAP).
121      * 
122      * @return outbound SAML message
123      */
124     public OutboundMessageType getOutboundSAMLMessage();
125 
126     /**
127      * Gets the ID of the outbound SAML message.
128      * 
129      * @return ID of the outbound SAML message
130      */
131     public String getOutboundSAMLMessageId();
132 
133     /**
134      * Gets the issue instant of the outbound SAML message.
135      * 
136      * @return issue instant of the outbound SAML message
137      */
138     public DateTime getOutboundSAMLMessageIssueInstant();
139 
140     /**
141      * Gets the protocol used by the local entity to communicate with the peer entity.
142      * 
143      * @return protocol used by the local entity to communicate with the peer entity
144      */
145     public String getOutboundSAMLProtocol();
146 
147     /**
148      * Gets the endpoint of for the peer entity.
149      * 
150      * @return endpoint of for the peer entity
151      */
152     public Endpoint getPeerEntityEndpoint();
153 
154     /**
155      * Gets the peer's entity ID.
156      * 
157      * @return peer's entity ID
158      */
159     public String getPeerEntityId();
160 
161     /**
162      * Gets the peer entity metadata.
163      * 
164      * @return peer entity metadata
165      */
166     public EntityDescriptor getPeerEntityMetadata();
167 
168     /**
169      * Gets the role of the peer entity.
170      * 
171      * @return role of the peer entity
172      */
173     public QName getPeerEntityRole();
174 
175     /**
176      * Gets the role of the peer entity.
177      * 
178      * @return role of the peer entity
179      */
180     public RoleDescriptor getPeerEntityRoleMetadata();
181 
182     /**
183      * Gets the relay state associated with the message.
184      * 
185      * @return relay state associated with the message
186      */
187     public String getRelayState();
188 
189     /**
190      * Gets the subject's SAML name identifier.
191      * 
192      * @return subject's SAML name identifier
193      */
194     public NameIdentifierType getSubjectNameIdentifier();
195 
196     /**
197      * Gets whether the inbound SAML message has been authenticated.
198      * 
199      * @return whether the inbound SAML message has been authenticated
200      */
201     public boolean isInboundSAMLMessageAuthenticated();
202 
203     /**
204      * Sets the inbound SAML message.
205      * 
206      * @param message inbound SAML message
207      */
208     public void setInboundSAMLMessage(InboundMessageType message);
209 
210     /**
211      * Sets whether the inbound SAML message has been authenticated.
212      * 
213      * @param isAuthenticated whether the inbound SAML message has been authenticated
214      */
215     public void setInboundSAMLMessageAuthenticated(boolean isAuthenticated);
216 
217     /**
218      * Sets the ID of the inbound SAML message.
219      * 
220      * @param id ID of the inbound SAML message
221      */
222     public void setInboundSAMLMessageId(String id);
223 
224     /**
225      * Sets the issue instant of the incomming SAML message.
226      * 
227      * @param instant issue instant of the incomming SAML message
228      */
229     public void setInboundSAMLMessageIssueInstant(DateTime instant);
230 
231     /**
232      * Sets the protocol used by the peer entity to communicate with the local entity.
233      * 
234      * @param protocol protocol used by the peer entity to communicate with the local entity
235      */
236     public void setInboundSAMLProtocol(String protocol);
237 
238     /**
239      * Sets the local entity's ID.
240      * 
241      * @param id local entity's ID
242      */
243     public void setLocalEntityId(String id);
244 
245     /**
246      * Sets the local entity metadata.
247      * 
248      * @param metadata local entity metadata
249      */
250     public void setLocalEntityMetadata(EntityDescriptor metadata);
251 
252     /**
253      * Sets the role of the local entity.
254      * 
255      * @param role role of the local entity
256      */
257     public void setLocalEntityRole(QName role);
258 
259     /**
260      * Sets the role metadata for the local entity.
261      * 
262      * @param role role metadata for the local entity
263      */
264     public void setLocalEntityRoleMetadata(RoleDescriptor role);
265 
266     /**
267      * Sets the metadata provider used to lookup information entity information.
268      * 
269      * @param provider metadata provider used to lookup information entity information
270      */
271     public void setMetadataProvider(MetadataProvider provider);
272 
273     /**
274      * Sets the artifact type to use for the outbound message.
275      * 
276      * @param type artifact type to use for the outbound message
277      */
278     public void setOutboundMessageArtifactType(byte[] type);
279 
280     /**
281      * Sets the outbound SAML message.
282      * 
283      * @param message outbound SAML message
284      */
285     public void setOutboundSAMLMessage(OutboundMessageType message);
286 
287     /**
288      * Sets the ID of the outbound SAML message.
289      * 
290      * @param id ID of the outbound SAML message
291      */
292     public void setOutboundSAMLMessageId(String id);
293 
294     /**
295      * Sets the issue instant of the outbound SAML message.
296      * 
297      * @param instant issue instant of the outbound SAML message
298      */
299     public void setOutboundSAMLMessageIssueInstant(DateTime instant);
300 
301     /**
302      * Sets the credential used to sign the outbound SAML message.
303      * 
304      * @param credential credential used to sign the outbound SAML message
305      */
306     public void setOutboundSAMLMessageSigningCredential(Credential credential);
307 
308     /**
309      * Sets the protocol used by the local entity to communicate with the peer entity.
310      * 
311      * @param protocol protocol used by the local entity to communicate with the peer entity
312      */
313     public void setOutboundSAMLProtocol(String protocol);
314 
315     /**
316      * Sets the endpoint of for the peer entity.
317      * 
318      * @param endpoint endpoint of for the peer entity
319      */
320     public void setPeerEntityEndpoint(Endpoint endpoint);
321 
322     /**
323      * Sets the peer's entity ID.
324      * 
325      * @param id peer's entity ID
326      */
327     public void setPeerEntityId(String id);
328 
329     /**
330      * Sets the peer entity metadata.
331      * 
332      * @param metadata peer entity metadata
333      */
334     public void setPeerEntityMetadata(EntityDescriptor metadata);
335 
336     /**
337      * Sets the role of the peer entity.
338      * 
339      * @param role role of the peer entity
340      */
341     public void setPeerEntityRole(QName role);
342 
343     /**
344      * Sets the role metadata for the peer entity.
345      * 
346      * @param role role metadata for the peer entity
347      */
348     public void setPeerEntityRoleMetadata(RoleDescriptor role);
349 
350     /**
351      * Sets the relay state associated with the message.
352      * 
353      * @param relayState relay state associated with the message
354      */
355     public void setRelayState(String relayState);
356 
357     /**
358      * Sets the subject's SAML name identifier.
359      * 
360      * @param identifier subject's SAML name identifier
361      */
362     public void setSubjectNameIdentifier(NameIdentifierType identifier);
363 }