Change license header, remove stale pkg files.
[shibboleth/cpp-opensaml.git] / saml / saml2 / binding / SAML2SOAPClient.h
1 /**
2  * Licensed to the University Corporation for Advanced Internet
3  * Development, Inc. (UCAID) under one or more contributor license
4  * agreements. See the NOTICE file distributed with this work for
5  * additional information regarding copyright ownership.
6  *
7  * UCAID licenses this file to you under the Apache License,
8  * Version 2.0 (the "License"); you may not use this file except
9  * in compliance with the License. You may obtain a copy of the
10  * License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17  * either express or implied. See the License for the specific
18  * language governing permissions and limitations under the License.
19  */
20
21 /**
22  * @file saml/saml2/binding/SAML2SOAPClient.h
23  * 
24  * Specialized SOAPClient for SAML 2.0 SOAP binding.
25  */
26
27 #ifndef __saml2_soap11client_h__
28 #define __saml2_soap11client_h__
29
30 #include <saml/base.h>
31
32 namespace opensaml {
33
34     class SAML_API SOAPClient;
35
36     namespace saml2md {
37         class SAML_API MetadataCredentialCriteria;
38     };
39
40     namespace saml2p {
41         
42         class SAML_API RequestAbstractType;
43         class SAML_API StatusResponseType;
44         class SAML_API Status;
45
46         /**
47          * Specialized SOAPClient for SAML 2.0 SOAP binding.
48          */
49         class SAML_API SAML2SOAPClient
50         {
51         public:
52             /**
53              * Constructor
54              * 
55              * @param soaper            reference to SOAPClient object to use for call
56              * @param fatalSAMLErrors   true iff a non-successful SAML Status code should be fatal
57              */
58             SAML2SOAPClient(SOAPClient& soaper, bool fatalSAMLErrors=true);
59
60             virtual ~SAML2SOAPClient();
61     
62             /**
63              * Specialized method for sending SAML 2.0 requests. The SOAP layer will be
64              * constructed automatically.
65              * 
66              * <p>The request will be freed by the client object regardless of the outcome.
67              * 
68              * @param request   SAML request to send
69              * @param to        peer to send message to, expressed in metadata criteria terms
70              * @param from      identity of sending application
71              * @param endpoint  URL of endpoint to recieve message
72              */
73             virtual void sendSAML(RequestAbstractType* request, const char* from, saml2md::MetadataCredentialCriteria& to, const char* endpoint);
74             
75             /**
76              * Specialized method for receiving SAML 2.0 responses. The SOAP layer will be
77              * evaluated automatically, and the attached policy will be applied to the Response.
78              * 
79              * <p>The caller is responsible for freeing the response.
80              * 
81              * @return SAML 2.0 response, after SecurityPolicy has been applied
82              */
83             virtual StatusResponseType* receiveSAML();
84
85         protected:
86             /**
87              * Handling of SAML errors.
88              * 
89              * @param status SAML Status received by client
90              * @return true iff the error should be treated as a fatal error
91              */
92             virtual bool handleError(const Status& status);
93
94             /** SOAP client object */
95             SOAPClient& m_soaper;
96
97             /** Flag controlling default error handler. */
98             bool m_fatal;
99
100         private:
101             XMLCh* m_correlate;
102         };
103         
104     };
105 };
106
107 #endif /* __saml2_soap11client_h__ */