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;
21 import javax.servlet.http.HttpServletRequest;
23 import org.opensaml.common.binding.MessageDecoder;
24 import org.opensaml.common.binding.MessageEncoder;
25 import org.opensaml.saml2.binding.HTTPSOAP11Decoder;
26 import org.opensaml.saml2.binding.HTTPSOAP11Encoder;
28 import edu.internet2.middleware.shibboleth.common.profile.ProfileException;
29 import edu.internet2.middleware.shibboleth.common.profile.ProfileRequest;
30 import edu.internet2.middleware.shibboleth.common.profile.ProfileResponse;
31 import edu.internet2.middleware.shibboleth.idp.session.Session;
34 * SAML 2.0 SOAP Attribute Query profile handler.
36 public class HTTPSOAPAttributeQuery extends AbstractAttributeQuery {
39 public HTTPSOAPAttributeQuery() {
44 @SuppressWarnings("unchecked")
45 protected MessageDecoder<ServletRequest> getMessageDecoder(ProfileRequest<ServletRequest> request)
46 throws ProfileException {
47 MessageDecoder decoder = new HTTPSOAP11Decoder();
48 decoder.setRequest(request.getRawRequest());
53 @SuppressWarnings("unchecked")
54 protected MessageEncoder<ServletResponse> getMessageEncoder(ProfileResponse<ServletResponse> response)
55 throws ProfileException {
56 MessageEncoder encoder = new HTTPSOAP11Encoder();
57 encoder.setResponse(response.getRawResponse());
62 protected String getUserSessionId(ProfileRequest<ServletRequest> request) {
63 HttpServletRequest rawRequest = (HttpServletRequest) request.getRawRequest();
64 if (rawRequest != null) {
65 return (String) rawRequest.getSession().getAttribute(Session.HTTP_SESSION_BINDING_ATTRIBUTE);