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.saml2.binding.decoding;
18  
19  import org.opensaml.common.binding.SAMLMessageContext;
20  import org.opensaml.common.xml.SAMLConstants;
21  import org.opensaml.ws.transport.http.HTTPInTransport;
22  import org.opensaml.xml.parse.ParserPool;
23  import org.opensaml.xml.util.DatatypeHelper;
24  
25  /** Message decoder implementing the SAML 2.0 HTTP POST-SimpleSign binding. */
26  public class HTTPPostSimpleSignDecoder extends HTTPPostDecoder {
27  
28      /**
29       * Constructor.
30       *
31       */
32      public HTTPPostSimpleSignDecoder() {
33          super();
34      }
35  
36      /**
37       * Constructor.
38       *
39       * @param pool parser pool used to deserialize messages
40       */
41      public HTTPPostSimpleSignDecoder(ParserPool pool) {
42          super(pool);
43      }
44  
45      /** {@inheritDoc} */
46      public String getBindingURI() {
47          return SAMLConstants.SAML2_POST_SIMPLE_SIGN_BINDING_URI;
48      }
49  
50      /** {@inheritDoc} */
51      protected boolean isMessageSigned(SAMLMessageContext messageContext) {
52          HTTPInTransport inTransport = (HTTPInTransport) messageContext.getInboundMessageTransport();
53          String sigParam = inTransport.getParameterValue("Signature");
54          return (!DatatypeHelper.isEmpty(sigParam)) || super.isMessageSigned(messageContext);
55      }
56      
57  }