2 * Copyright 2010 JANET(UK)
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.
20 * An embeddable component interface to Shibboleth SP attribute processing.
25 #include <shibsp/ServiceProvider.h>
26 #include <shibsp/attribute/Attribute.h>
27 #include <shibsp/remoting/ListenerService.h>
29 using namespace shibresolver;
30 using namespace shibsp;
32 using namespace opensaml;
34 using namespace xmltooling;
37 namespace shibresolver {
38 class SHIBRESOLVER_DLLLOCAL RemotedResolver : public Remoted {
43 void receive(DDF& in, ostream& out);
46 static RemotedResolver g_Remoted;
49 ShibbolethResolver* ShibbolethResolver::create()
51 return new ShibbolethResolver();
54 ShibbolethResolver::ShibbolethResolver()
58 ShibbolethResolver::~ShibbolethResolver()
60 for_each(m_resolvedAttributes.begin(), m_resolvedAttributes.end(), xmltooling::cleanup<Attribute>());
67 void ShibbolethResolver::setServiceURI(const char* uri)
74 void ShibbolethResolver::setApplicationID(const char* appID)
81 void ShibbolethResolver::setIssuer(const char* issuer)
88 void ShibbolethResolver::addToken(
90 const XMLObject* token
92 const saml2::Assertion* token
97 m_tokens.push_back(token);
100 void ShibbolethResolver::addAttribute(Attribute* attr)
103 m_inputAttributes.push_back(attr);
106 vector<Attribute*>& ShibbolethResolver::getResolvedAttributes()
108 return m_resolvedAttributes;
111 RequestMapper::Settings ShibbolethResolver::getSettings() const
116 void ShibbolethResolver::resolve()
120 void RemotedResolver::receive(DDF& in, ostream& out)
124 extern "C" int SHIBRESOLVER_EXPORTS xmltooling_extension_init(void*)
126 #ifdef SHIBRESOLVER_SHIBSP_HAS_REMOTING
127 SPConfig& conf = SPConfig::getConfig();
128 if (conf.isEnabled(SPConfig::OutOfProcess) && !conf.isEnabled(SPConfig::InProcess) && conf.isEnabled(SPConfig::Listener))
129 conf.getServiceProvider()->regListener("org.project-moonshot.shibresolver", &g_Remoted);
131 return 0; // signal success
134 extern "C" void SHIBRESOLVER_EXPORTS xmltooling_extension_term()
136 // Factories normally get unregistered during library shutdown, so no work usually required here.