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/saml2/metadata/Metadata.h>
32 #include <xmltooling/unicode.h>
36 class SHIBSP_API Attribute;
37 class SHIBSP_API ResolutionContext;
39 #if defined (_MSC_VER)
40 #pragma warning( push )
41 #pragma warning( disable : 4250 )
45 * Base class for handlers that create sessions by consuming SSO protocol responses.
47 class SHIBSP_API AssertionConsumerService : public AbstractHandler, public RemotedHandler
50 virtual ~AssertionConsumerService();
52 std::pair<bool,long> run(SPRequest& request, bool isHandler=true) const;
53 void receive(DDF& in, std::ostream& out);
59 * @param e root of DOM configuration
60 * @param appId ID of application that "owns" the handler
61 * @param log a logging object to use
63 AssertionConsumerService(const xercesc::DOMElement* e, const char* appId, log4cpp::Category& log);
67 * Implement protocol-specific handling of the incoming decoded message.
69 * <p>The result of implementing the protocol should be an exception or
70 * the key to a newly created session.
72 * @param application reference to application receiving message
73 * @param httpRequest client request that included message
74 * @param policy the SecurityPolicy in effect, after having evaluated the message
75 * @param settings policy configuration settings in effect
76 * @param xmlObject a protocol-specific message object
77 * @return the key to the newly created session
79 virtual std::string implementProtocol(
80 const Application& application,
81 const xmltooling::HTTPRequest& httpRequest,
82 opensaml::SecurityPolicy& policy,
83 const PropertySet* settings,
84 const xmltooling::XMLObject& xmlObject
88 * Attempt SSO-initiated attribute resolution using the supplied information.
90 * <p>The caller must free the returned context handle.
92 * @param application reference to application receiving message
93 * @param issuer source of SSO tokens
94 * @param nameid identifier of principal
95 * @param authncontext_class method/category of authentication event, if known
96 * @param authncontext_decl specifics of authentication event, if known
97 * @param tokens available assertions, if any
98 * @param attributes attributes already extracted, if any
100 ResolutionContext* resolveAttributes(
101 const Application& application,
102 const opensaml::saml2md::EntityDescriptor* issuer=NULL,
103 const opensaml::saml2::NameID* nameid=NULL,
104 const char* authncontext_class=NULL,
105 const char* authncontext_decl=NULL,
106 const std::vector<const opensaml::Assertion*>* tokens=NULL,
107 const std::multimap<std::string,Attribute*>* attributes=NULL
112 * Enforce address checking requirements.
114 * @param application reference to application receiving message
115 * @param httpRequest client request that initiated session
116 * @param issuedTo address for which security assertion was issued
119 const Application& application, const xmltooling::HTTPRequest& httpRequest, const char* issuedTo
123 std::string processMessage(
124 const Application& application,
125 xmltooling::HTTPRequest& httpRequest,
126 std::string& entityID,
127 std::string& relayState
130 std::pair<bool,long> sendRedirect(
131 SPRequest& request, const char* key, const char* entityID, const char* relayState
134 void maintainHistory(SPRequest& request, const char* entityID, const char* cookieProps) const;
137 opensaml::MessageDecoder* m_decoder;
138 xmltooling::QName m_role;
142 #if defined (_MSC_VER)
143 #pragma warning( pop )
148 #endif /* __shibsp_acshandler_h__ */