2 * Copyright 2001-2009 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/SessionInitiator.h
20 * Pluggable runtime functionality that handles initiating sessions.
23 #ifndef __shibsp_initiator_h__
24 #define __shibsp_initiator_h__
26 #include <shibsp/handler/Handler.h>
31 * Pluggable runtime functionality that handles initiating sessions.
33 * <p>By default, SessionInitiators look for an entityID on the incoming request
34 * and pass control to the specialized run method.
36 class SHIBSP_API SessionInitiator : public virtual Handler
38 friend void SHIBSP_API registerSessionInitiators();
40 /** Property remapper for configuration compatibility. */
41 static std::map<std::string,std::string> m_remapper;
46 virtual ~SessionInitiator();
49 * Executes an incoming request.
51 * <p>SessionInitiators can be run either directly by incoming web requests
52 * or indirectly/implicitly during other SP processing.
54 * @param request SP request context
55 * @param entityID the name of an IdP to request a session from, if known
56 * @param isHandler true iff executing in the context of a direct handler invocation
57 * @return a pair containing a "request completed" indicator and a server-specific response code
59 virtual std::pair<bool,long> run(SPRequest& request, std::string& entityID, bool isHandler=true) const=0;
61 std::pair<bool,long> run(SPRequest& request, bool isHandler=true) const;
64 const char* getType() const;
68 /** Registers SessionInitiator implementations. */
69 void SHIBSP_API registerSessionInitiators();
71 /** SessionInitiator that iterates through a set of protocol-specific versions. */
72 #define CHAINING_SESSION_INITIATOR "Chaining"
74 /** SessionInitiator that supports SAML 2.0 AuthnRequests. */
75 #define SAML2_SESSION_INITIATOR "SAML2"
77 /** SessionInitiator that supports SAML Discovery Service protocol. */
78 #define SAMLDS_SESSION_INITIATOR "SAMLDS"
80 /** SessionInitiator that supports Shibboleth V1 AuthnRequest redirects. */
81 #define SHIB1_SESSION_INITIATOR "Shib1"
83 /** SessionInitiator that supports Shibboleth V1 WAYF redirects when no IdP is supplied. */
84 #define WAYF_SESSION_INITIATOR "WAYF"
86 /** SessionInitiator that attempts a sequence of transforms of an input until an entityID is found. */
87 #define TRANSFORM_SESSION_INITIATOR "Transform"
89 /** SessionInitiator that uses HTML form submission from the user. */
90 #define FORM_SESSION_INITIATOR "Form"
92 /** SessionInitiator that reads the CDC. */
93 #define COOKIE_SESSION_INITIATOR "Cookie"
96 #endif /* __shibsp_initiator_h__ */