2 * Copyright 2001-2007 Internet2
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.
18 * @file saml/binding/SOAPClient.h
20 * Specialized SOAPClient for SAML SOAP bindings.
23 #ifndef __saml_soap11client_h__
24 #define __saml_soap11client_h__
26 #include <saml/binding/SecurityPolicy.h>
27 #include <xmltooling/soap/SOAPClient.h>
32 * Specialized SOAPClient for SAML SOAP bindings.
34 class SAML_API SOAPClient : soap11::SOAPClient
38 * Creates a SOAP client instance with a particular SecurityPolicy.
40 * @param policy reference to SecurityPolicy to apply
42 SOAPClient(SecurityPolicy& policy) : m_policy(policy), m_force(true) {}
44 virtual ~SOAPClient() {}
47 * Controls whether to force transport/peer authentication via an X509TrustEngine.
49 * <p>Only makes sense if an X509TrustEngine is supplied by the SecurityPolicy.
51 * @param force true iff the client should refuse to communicate without this protection
53 void forceTransportAuthentication(bool force=true) {
58 * Override prepares the SecurityPolicy by clearing Issuer identity, in case the policy
61 * @param env SOAP envelope to send
62 * @param peer peer to send message to, expressed in TrustEngine terms
63 * @param endpoint URL of endpoint to recieve message
65 void send(const soap11::Envelope* env, const xmltooling::KeyInfoSource& peer, const char* endpoint);
68 * Override applies SecurityPolicy to envelope before returning it.
70 * @return response envelope after SecurityPolicy has been applied
72 soap11::Envelope* receive();
76 * Override prepares transport by assigning an X509TrustEngine to it, if one is
77 * attached to the policy.
79 * @param transport reference to transport layer
81 void prepareTransport(const xmltooling::SOAPTransport& transport);
83 /** Reference to security policy to apply. */
84 SecurityPolicy& m_policy;
86 /** Flag controlling whether transport/peer authn is mandatory. */
90 const saml2md::RoleDescriptor* m_peer;
95 #endif /* __saml_soap11client_h__ */