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>
29 # include <saml/binding/MessageDecoder.h>
30 # include <saml/saml1/core/Assertions.h>
31 # include <saml/saml2/metadata/Metadata.h>
33 #include <xmltooling/unicode.h>
37 class SHIBSP_API Attribute;
38 class SHIBSP_API ResolutionContext;
40 #if defined (_MSC_VER)
41 #pragma warning( push )
42 #pragma warning( disable : 4250 )
46 * Base class for handlers that create sessions by consuming SSO protocol responses.
48 class SHIBSP_API AssertionConsumerService : public AbstractHandler, public RemotedHandler
51 virtual ~AssertionConsumerService();
53 std::pair<bool,long> run(SPRequest& request, bool isHandler=true) const;
54 void receive(DDF& in, std::ostream& out);
60 * @param e root of DOM configuration
61 * @param appId ID of application that "owns" the handler
62 * @param log a logging object to use
64 AssertionConsumerService(const xercesc::DOMElement* e, const char* appId, xmltooling::logging::Category& log);
68 * Implement protocol-specific handling of the incoming decoded message.
70 * <p>The result of implementing the protocol should be an exception or
71 * the key to a newly created session.
73 * @param application reference to application receiving message
74 * @param httpRequest client request that included message
75 * @param policy the SecurityPolicy in effect, after having evaluated the message
76 * @param settings policy configuration settings in effect
77 * @param xmlObject a protocol-specific message object
78 * @return the key to the newly created session
80 virtual std::string implementProtocol(
81 const Application& application,
82 const xmltooling::HTTPRequest& httpRequest,
83 opensaml::SecurityPolicy& policy,
84 const PropertySet* settings,
85 const xmltooling::XMLObject& xmlObject
89 * Extracts policy-relevant assertion details.
\r
91 * @param assertion the incoming assertion
\r
92 * @param protocol the protocol family in use
\r
93 * @param policy SecurityPolicy to provide various components and track message data
\r
95 virtual void extractMessageDetails(
\r
96 const opensaml::Assertion& assertion, const XMLCh* protocol, opensaml::SecurityPolicy& policy
\r
100 * Attempt SSO-initiated attribute resolution using the supplied information,
101 * including NameID and token extraction and filtering followed by
102 * secondary resolution.
104 * <p>The caller must free the returned context handle.
106 * @param application reference to application receiving message
107 * @param issuer source of SSO tokens
108 * @param protocol SSO protocol used
109 * @param v1nameid identifier of principal in SAML 1.x form, if any
110 * @param nameid identifier of principal in SAML 2.0 form
111 * @param authncontext_class method/category of authentication event, if known
112 * @param authncontext_decl specifics of authentication event, if known
113 * @param tokens available assertions, if any
115 ResolutionContext* resolveAttributes(
116 const Application& application,
117 const opensaml::saml2md::RoleDescriptor* issuer=NULL,
118 const XMLCh* protocol=NULL,
119 const opensaml::saml1::NameIdentifier* v1nameid=NULL,
120 const opensaml::saml2::NameID* nameid=NULL,
121 const XMLCh* authncontext_class=NULL,
122 const XMLCh* authncontext_decl=NULL,
123 const std::vector<const opensaml::Assertion*>* tokens=NULL
128 * Enforce address checking requirements.
130 * @param application reference to application receiving message
131 * @param httpRequest client request that initiated session
132 * @param issuedTo address for which security assertion was issued
135 const Application& application, const xmltooling::HTTPRequest& httpRequest, const char* issuedTo
139 std::string processMessage(
140 const Application& application,
141 xmltooling::HTTPRequest& httpRequest,
142 std::string& entityID,
143 std::string& relayState
146 std::pair<bool,long> sendRedirect(
147 SPRequest& request, const char* key, const char* entityID, const char* relayState
150 void maintainHistory(SPRequest& request, const char* entityID, const char* cookieProps) const;
153 opensaml::MessageDecoder* m_decoder;
154 xmltooling::QName m_role;
158 #if defined (_MSC_VER)
159 #pragma warning( pop )
164 #endif /* __shibsp_acshandler_h__ */