2 * Copyright 2010 Project Moonshot
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 shibresolver/resolver.h
20 * An embeddable component interface to Shibboleth SP attribute processing.
23 #ifndef __shibresolver_h__
24 #define __shibresolver_h__
27 #include <shibresolver/base.h>
29 #define SHIBRESOLVER_API SHIBSP_API
35 namespace xmltooling {
36 class XMLTOOL_API XMLObject;
41 class SAML_API Assertion;
42 class SAML_API NameID;
47 class SHIBSP_API Attribute;
50 namespace shibresolver {
52 #if defined (_MSC_VER)
53 #pragma warning( push )
54 #pragma warning( disable : 4250 4251 )
58 * An embeddable component interface to Shibboleth SP attribute processing.
60 class SHIBRESOLVER_API ShibbolethResolver
62 MAKE_NONCOPYABLE(ShibbolethResolver);
64 ShibbolethResolver() {}
66 ~ShibbolethResolver() {}
69 * Sets the application ID to use for resolution.
71 * @param appID identifies an application in the SP configuration
73 void setApplicationID(const char* appID) {}
76 * Sets the identity issuer to use for resolution.
78 * @param issuer entityID of the identity "source", if known
80 void setIssuer(const char* issuer) {}
83 * Adds a SAML token as input to the resolver.
84 * <p>The caller retains ownership of the object.
86 * @param token an input token to evaluate
90 const xmltooling::XMLObject* token
92 const opensaml::saml2::Assertion* token
97 * Adds an Attribute as input to the resolver.
98 * <p>The caller retains ownership of the object, but it MAY be modified
99 * during the resolution process.
101 * @param attr an input attribute
103 void addAttribute(shibsp::Attribute* attr) {}
106 * Resolves attributes and returns them in the supplied array.
107 * <p>The caller is responsible for freeing them.
109 * @param attrs array to populate
111 void resolveAttributes(std::vector<shibsp::Attribute*>& attrs) {}
114 * Initializes SP runtime objects based on an XML configuration string or a configuration pathname.
115 * <p>Each process using the library MUST call this function exactly once before using any library classes.
117 * @param config a snippet of XML to parse (it <strong>MUST</strong> contain a type attribute) or a pathname
118 * @param rethrow true iff caught exceptions should be rethrown instead of just returning the status
119 * @return true iff initialization was successful
121 static bool init(const char* config=NULL, bool rethrow=false) { return true; }
124 * Shuts down runtime.
126 * Each process using the library SHOULD call this function exactly once before terminating itself.
128 static void term() {}
131 * Returns a ShibbolethResolver instance.
133 * @return a ShibbolethResolver instance, must be freed by the caller.
135 static ShibbolethResolver* create() { return new ShibbolethResolver(); }
138 /** Application ID. */
141 /** Source of identity, if known. */
142 std::string m_issuer;
146 std::vector<const xmltooling::XMLObject*> m_tokens;
148 std::vector<const opensaml::saml2::Assertion*> m_tokens;
150 /** Input attributes. */
151 std::vector<shibsp::Attribute*> m_attributes;
154 #if defined (_MSC_VER)
155 #pragma warning( pop )
160 #endif /* __shibresolver_h__ */