Imported Upstream version 2.3+dfsg
[shibboleth/sp.git] / shibsp / binding / SOAPClient.h
1 /*
2  *  Copyright 2001-2009 Internet2
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 /**
18  * @file shibsp/binding/SOAPClient.h
19  * 
20  * Specialized SOAPClient for SP environment.
21  */
22
23 #ifndef __shibsp_soap11client_h__
24 #define __shibsp_soap11client_h__
25
26 #include <shibsp/base.h>
27
28 #include <saml/binding/SOAPClient.h>
29
30 namespace shibsp {
31
32     class SHIBSP_API PropertySet;
33     class SHIBSP_API SecurityPolicy;
34
35     /**
36      * Specialized SOAPClient for SP environment.
37      */
38     class SHIBSP_API SOAPClient : public opensaml::SOAPClient
39     {
40     public:
41         /**
42          * Creates a SOAP client instance for an Application to use.
43          * 
44          * @param policy        reference to SP-SecurityPolicy to apply
45          */
46         SOAPClient(SecurityPolicy& policy);
47         
48         virtual ~SOAPClient();
49
50         /**
51          * Override handles message signing for SAML payloads.
52          * 
53          * @param env       SOAP envelope to send
54          * @param from      identity of sending application
55          * @param to        peer to send message to, expressed in metadata terms
56          * @param endpoint  URL of endpoint to recieve message
57          */
58         void send(const soap11::Envelope& env, const char* from, opensaml::saml2md::MetadataCredentialCriteria& to, const char* endpoint);
59
60         void reset();
61
62     protected:
63         /**
64          * Override prepares transport by applying policy settings from Application.
65          * 
66          * @param transport reference to transport layer
67          */
68         void prepareTransport(xmltooling::SOAPTransport& transport);
69
70         /** Application supplied to client. */
71         const Application& m_app;
72
73         /** RelyingParty properties, set after transport prep. */
74         const PropertySet* m_relyingParty;
75
76         /** Locked CredentialResolver for transport, set after transport prep. */
77         xmltooling::CredentialResolver* m_credResolver;
78     };
79
80 };
81
82 #endif /* __shibsp_soap11client_h__ */