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 protected MessageDecoder<ServletRequest> getMessageDecoder(ProfileRequest<ServletRequest> request)
45 throws ProfileException {
46 MessageDecoder<ServletRequest> decoder = new HTTPSOAP11Decoder();
47 decoder.setRequest(request.getRawRequest());
52 protected MessageEncoder<ServletResponse> getMessageEncoder(ProfileResponse<ServletResponse> response)
53 throws ProfileException {
54 MessageEncoder<ServletResponse> encoder = new HTTPSOAP11Encoder();
55 encoder.setResponse(response.getRawResponse());
60 protected String getUserSessionId(ProfileRequest<ServletRequest> request) {
61 HttpServletRequest rawRequest = (HttpServletRequest) request.getRawRequest();
62 if (rawRequest != null) {
63 return (String) rawRequest.getSession().getAttribute(Session.HTTP_SESSION_BINDING_ATTRIBUTE);