2 * Copyright [2007] [University Corporation for Advanced Internet Development, Inc.]
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package edu.internet2.middleware.shibboleth.idp.profile.saml2;
19 import javax.servlet.ServletRequest;
20 import javax.servlet.ServletResponse;
22 import org.opensaml.common.binding.decoding.MessageDecoder;
23 import org.opensaml.common.binding.encoding.MessageEncoder;
25 import edu.internet2.middleware.shibboleth.common.profile.ProfileException;
28 * SAML 2.0 SOAP Attribute Query profile handler.
30 public class HTTPSOAPAttributeQuery extends AbstractAttributeQuery {
32 /** SAML binding URI. */
33 public static final String BINDING = "urn:oasis:names:tc:SAML:2.0:bindings:SOAP";
36 public HTTPSOAPAttributeQuery() {
41 @SuppressWarnings("unchecked")
42 protected void getMessageDecoder(AttributeQueryRequestContext requestContext) throws ProfileException {
43 MessageDecoder<ServletRequest> decoder = getMessageDecoderFactory().getMessageDecoder(BINDING);
44 if (decoder == null) {
45 throw new ProfileException("No request decoder was registered for binding type: " + BINDING);
48 super.populateMessageDecoder(decoder);
49 decoder.setRequest(requestContext.getProfileRequest().getRawRequest());
50 requestContext.setMessageDecoder(decoder);
54 @SuppressWarnings("unchecked")
55 protected void getMessageEncoder(AttributeQueryRequestContext requestContext) throws ProfileException {
57 MessageEncoder<ServletResponse> encoder = getMessageEncoderFactory().getMessageEncoder(BINDING);
58 if (encoder == null) {
59 throw new ProfileException("No response encoder was registered for binding type: " + BINDING);
62 super.populateMessageEncoder(encoder);
63 encoder.setResponse(requestContext.getProfileResponse().getRawResponse());
64 encoder.setSamlMessage(requestContext.getAttributeQueryResponse());
65 requestContext.setMessageEncoder(encoder);