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 shibsp/handler/AssertionConsumerService.h
20 * Base class for handlers that create sessions by consuming SSO protocol responses.
23 #ifndef __shibsp_acshandler_h__
24 #define __shibsp_acshandler_h__
26 #include <shibsp/handler/AbstractHandler.h>
27 #include <shibsp/handler/RemotedHandler.h>
28 #include <saml/binding/MessageDecoder.h>
29 #include <saml/saml2/metadata/Metadata.h>
33 class SHIBSP_API ResolutionContext;
35 #if defined (_MSC_VER)
36 #pragma warning( push )
37 #pragma warning( disable : 4250 )
41 * Base class for handlers that create sessions by consuming SSO protocol responses.
43 class SHIBSP_API AssertionConsumerService : public AbstractHandler, public RemotedHandler
46 virtual ~AssertionConsumerService();
48 std::pair<bool,long> run(SPRequest& request, bool isHandler=true) const;
49 void receive(DDF& in, std::ostream& out);
52 AssertionConsumerService(const DOMElement* e, log4cpp::Category& log);
55 * Implement protocol-specific handling of the incoming decoded message.
57 * <p>The result of implementing the protocol should be an exception or
58 * the key to a newly created session.
60 * @param application reference to application receiving message
61 * @param httpRequest client request that included message
62 * @param policy the SecurityPolicy in effect, after having evaluated the message
63 * @param settings policy configuration settings in effect
64 * @param xmlObject a protocol-specific message object
65 * @return the key to the newly created session
67 virtual std::string implementProtocol(
68 const Application& application,
69 const opensaml::HTTPRequest& httpRequest,
70 opensaml::SecurityPolicy& policy,
71 const PropertySet* settings,
72 const xmltooling::XMLObject& xmlObject
76 * Enforce address checking requirements.
78 * @param application reference to application receiving message
79 * @param httpRequest client request that initiated session
80 * @param issuedTo address for which security assertion was issued
83 const Application& application, const opensaml::HTTPRequest& httpRequest, const char* issuedTo
87 * Attempt SSO-initiated attribute resolution using the supplied information.
89 * <p>The caller must free the returned context handle.
91 * @param application reference to application receiving message
92 * @param httpRequest client request that initiated session
93 * @param issuer source of SSO tokens
94 * @param nameid identifier of principal
95 * @param tokens tokens to resolve, if any
97 ResolutionContext* resolveAttributes(
98 const Application& application,
99 const opensaml::HTTPRequest& httpRequest,
100 const opensaml::saml2md::EntityDescriptor* issuer,
101 const opensaml::saml2::NameID& nameid,
102 const std::vector<const opensaml::Assertion*>* tokens=NULL
106 std::string processMessage(
107 const Application& application,
108 opensaml::HTTPRequest& httpRequest,
109 std::string& providerId,
110 std::string& relayState
113 std::pair<bool,long> sendRedirect(
114 SPRequest& request, const char* key, const char* providerId, const char* relayState
117 void maintainHistory(SPRequest& request, const char* providerId, const char* cookieProps) const;
119 opensaml::MessageDecoder* m_decoder;
120 xmltooling::auto_ptr_char m_configNS;
121 xmltooling::QName m_role;
124 #if defined (_MSC_VER)
125 #pragma warning( pop )
130 #endif /* __shibsp_acshandler_h__ */