<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">Hi Shibboleth Developers,</span><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14px;background-color:rgb(255,255,255)">
<div><br></div><div>I have a question about Shibboleth SP extension:</div><div> Can I introduce a new SP Handler implementation, using SP's extension mechanism?</div><div><br></div><div>Detail:</div><div>I want to introduce another Handler to let the SP return something meaningful, aside from SAML protocol.</div>
<div>I tried implementing it, which was not successful.</div><div><br></div><div>My current implementation looks like this:</div><div><br></div><div>----</div><div>(include .. namespace ..)</div><div><br clear="all"><div>
<div>namespace test {</div><div> class SHIBSP_DLLLOCAL ExtraHandler : public AbstractHandler {</div><div> public:</div><div> ExtraHandler(const DOMElement* e, const char* appId);</div><div> virtual ~ExtraHandler() {}</div>
<div><br></div><div> std::pair<bool,long> run(SPRequest& request, bool isHandler=true) const;</div><div> private:</div><div> };</div><div><br></div><div> Handler* SHIBSP_DLLLOCAL ExtraHandlerFactory(const pair<const DOMElement*,const char*>& p) {</div>
<div> return new ExtraHandler(p.first, p.second);</div><div> }</div><div>}</div><div>using namespace test;</div><div><br></div><div>ExtraHandler::ExtraHandler(const DOMElement* e, const char* appId)</div><div> : AbstractHandler(e, xmltooling::logging::Category::getInstance(TEST_EXTENSION ".ExtraHandler")) {</div>
<div> m_log.debug("(constructor): appId=%s", appId);</div><div>}</div><div><br></div><div>std::pair<bool,long> ExtraHandler::run(SPRequest& request, bool isHandler) const {</div><div> m_log.debug("run");</div>
<div><br></div><div> HTTPResponse& response = request;</div><div> istringstream iss("<html>hello</html>");</div><div> return make_pair(true, response.sendResponse(iss));</div><div>}</div>
</div><div><br></div><div>..</div><div><br></div><div><div>extern "C" int xmltooling_extension_init(void*)</div><div>{</div></div><div> SPConfig& conf = SPConfig::getConfig();</div><div> conf.HandlerManager.registerFactory("Extra", ExtraHandlerFactory);</div>
<div>}</div><div>----</div><div><br></div><div>Relevant part of shibboleth2.xml looks like this</div><div>---</div><div><div> <Sessions lifetime="28800" timeout="3600" checkAddress="false" relayState="ss:mem" handlerSSL="false"></div>
<div> <SSO discoveryProtocol="SAMLDS" discoveryURL="https://(ds-host)/shibboleth-ds"></div><div> SAML2 SAML1</div><div> </SSO></div><div><br></div><div> <Logout>SAML2 Local</Logout></div>
<div> <Handler type="MetadataGenerator" Location="/Metadata" signing="false"/></div><div> <Handler type="Status" Location="/Status" acl="127.0.0.1"/></div>
<div> <Handler type="Session" Location="/Session" showAttributeValues="true"/></div><div> <Handler type="DiscoveryFeed" Location="/DiscoFeed"/></div>
<div><br></div><div> <!-- Handler from the custom extension.. --></div><div> <Handler type="Extra" Location="/Extra"/> <-- ... --></div><div> <Handler type="Session" Location="/Extra2"/> <-- for debugging --></div>
<div><br></div><div> </Sessions></div></div><div>----</div><div><br></div><div>After putting the shared object in a right directory and rebooting shibd,</div><div>I successfully saw "(constructor): appId=default" log message in my shibd.log, which is</div>
<div>embedded in my implementation of ExtraHandler (as you can see above).</div><div>At this point, I assumed ExtraHandler was detected and loaded by the SP appropriately.</div><div><br></div><div>After that, however, I couldn't access to the relevant URL, https://(myhost)/Shibboleth.sso/Extra.</div>
<div>SP raises shibsp::ConfigurationException with saying "Shibboleth handler invoked at an unconfigured location."</div><div>though SP already appears to know the Handler is there, according to the previous log message.</div>
<div>No relevant error log was seen in shibd.log, while ideally I should be seeing "run" log message.</div><div>Apparently the new Handler's run() member function was not called at all.</div><div><br></div><div>
https://(myhost)/Shibboleth.sso/Extra2, which was appended just for debugging in shibboleth2.xml, was</div><div>effective with "Session" type even in that situation.</div><div><br></div><div>This might be just my simple mistake, but I'd like to know if this is even possible.</div>
<div>I kind of suspect it may not.</div><div><br></div><div>Thanks,</div></div></div><div><br></div>-- <br>Daisuke Miyakawa (宮川大輔)<br><a href="mailto:d.miyakawa@gmail.com">d.miyakawa@gmail.com</a>