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.
17 /* shib.h - Shibboleth header file
28 #include <saml/saml2/metadata/Metadata.h>
29 #include <saml/saml2/metadata/MetadataProvider.h>
30 #include <xmltooling/security/TrustEngine.h>
32 #include <saml/saml.h>
33 #undef SAML10_PROTOCOL_ENUM
37 # define SHIB_EXPORTS __declspec(dllimport)
45 struct SHIB_EXPORTS IAttributeFactory : public virtual saml::IPlugIn
47 virtual saml::SAMLAttribute* build(DOMElement* e) const=0;
48 virtual ~IAttributeFactory() {}
51 // Subclass around the OpenSAML browser profile interface,
52 // incoporates additional functionality using Shib-defined APIs.
53 class SHIB_EXPORTS ShibBrowserProfile : virtual public saml::SAMLBrowserProfile
56 struct SHIB_EXPORTS ITokenValidator {
57 virtual void validateToken(
58 saml::SAMLAssertion* token,
60 const opensaml::saml2md::RoleDescriptor* role=NULL,
61 const xmltooling::TrustEngine* trustEngine=NULL
63 virtual ~ITokenValidator() {}
67 const ITokenValidator* validator,
68 opensaml::saml2md::MetadataProvider* metadata=NULL,
69 xmltooling::TrustEngine* trust=NULL
71 virtual ~ShibBrowserProfile();
73 virtual saml::SAMLBrowserProfile::BrowserProfileResponse receive(
74 const char* samlResponse,
75 const XMLCh* recipient,
76 saml::IReplayCache* replayCache,
79 virtual saml::SAMLBrowserProfile::BrowserProfileResponse receive(
80 saml::Iterator<const char*> artifacts,
81 const XMLCh* recipient,
82 saml::SAMLBrowserProfile::ArtifactMapper* artifactMapper,
83 saml::IReplayCache* replayCache,
88 void postprocess(saml::SAMLBrowserProfile::BrowserProfileResponse& bpr, int minorVersion=1) const;
90 saml::SAMLBrowserProfile* m_profile;
91 opensaml::saml2md::MetadataProvider* m_metadata;
92 xmltooling::TrustEngine* m_trust;
93 const ITokenValidator* m_validator;
96 class SHIB_EXPORTS ShibConfig
100 virtual ~ShibConfig() {}
102 // global per-process setup and shutdown of Shibboleth runtime
106 // manages specific attribute name to factory mappings
107 void regAttributeMapping(const XMLCh* name, const IAttributeFactory* factory);
108 void unregAttributeMapping(const XMLCh* name);
109 void clearAttributeMappings();
111 // enables runtime and clients to access configuration
112 static ShibConfig& getConfig();