<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>&nbsp; Can I introduce a new SP Handler implementation, using SP&#39;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>&nbsp; &nbsp; class SHIBSP_DLLLOCAL ExtraHandler : public AbstractHandler {</div><div>&nbsp; &nbsp; public:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; ExtraHandler(const DOMElement* e, const char* appId);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; virtual ~ExtraHandler() {}</div>
<div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; std::pair&lt;bool,long&gt; run(SPRequest&amp; request, bool isHandler=true) const;</div><div>&nbsp; &nbsp; private:</div><div>&nbsp; &nbsp; };</div><div><br></div><div>&nbsp; &nbsp; Handler* SHIBSP_DLLLOCAL ExtraHandlerFactory(const pair&lt;const DOMElement*,const char*&gt;&amp; p) {</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; return new ExtraHandler(p.first, p.second);</div><div>&nbsp; &nbsp; }</div><div>}</div><div>using namespace test;</div><div><br></div><div>ExtraHandler::ExtraHandler(const DOMElement* e, const char* appId)</div><div>&nbsp; &nbsp; : AbstractHandler(e, xmltooling::logging::Category::getInstance(TEST_EXTENSION &quot;.ExtraHandler&quot;)) {</div>
<div>&nbsp; &nbsp; m_log.debug(&quot;(constructor): appId=%s&quot;, appId);</div><div>}</div><div><br></div><div>std::pair&lt;bool,long&gt; ExtraHandler::run(SPRequest&amp; request, bool isHandler) const {</div><div>&nbsp; &nbsp; m_log.debug(&quot;run&quot;);</div>
<div><br></div><div>&nbsp; &nbsp; HTTPResponse&amp; response = request;</div><div>&nbsp; &nbsp; istringstream iss(&quot;&lt;html&gt;hello&lt;/html&gt;&quot;);</div><div>&nbsp; &nbsp; return make_pair(true, response.sendResponse(iss));</div><div>}</div>
</div><div><br></div><div>..</div><div><br></div><div><div>extern &quot;C&quot; int xmltooling_extension_init(void*)</div><div>{</div></div><div>&nbsp; &nbsp;SPConfig&amp; conf = SPConfig::getConfig();</div><div>&nbsp; &nbsp;conf.HandlerManager.registerFactory(&quot;Extra&quot;, ExtraHandlerFactory);</div>
<div>}</div><div>----</div><div><br></div><div>Relevant part of&nbsp;shibboleth2.xml looks like this</div><div>---</div><div><div>&nbsp; &nbsp; &nbsp; &nbsp; &lt;Sessions lifetime=&quot;28800&quot; timeout=&quot;3600&quot; checkAddress=&quot;false&quot; relayState=&quot;ss:mem&quot; handlerSSL=&quot;false&quot;&gt;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;SSO discoveryProtocol=&quot;SAMLDS&quot; discoveryURL=&quot;https://(ds-host)/shibboleth-ds&quot;&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SAML2 SAML1</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/SSO&gt;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Logout&gt;SAML2 Local&lt;/Logout&gt;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Handler type=&quot;MetadataGenerator&quot; Location=&quot;/Metadata&quot; signing=&quot;false&quot;/&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Handler type=&quot;Status&quot; Location=&quot;/Status&quot; acl=&quot;127.0.0.1&quot;/&gt;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Handler type=&quot;Session&quot; Location=&quot;/Session&quot; showAttributeValues=&quot;true&quot;/&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Handler type=&quot;DiscoveryFeed&quot; Location=&quot;/DiscoFeed&quot;/&gt;</div>
<div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;!-- Handler from the custom extension.. --&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Handler type=&quot;Extra&quot; Location=&quot;/Extra&quot;/&gt; &nbsp; &nbsp; &nbsp; &nbsp;&lt;-- ... &nbsp;--&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Handler type=&quot;Session&quot; Location=&quot;/Extra2&quot;/&gt; &nbsp;&lt;-- for debugging --&gt;</div>
<div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/Sessions&gt;</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 &quot;(constructor): appId=default&quot; 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&#39;t&nbsp;access to the relevant URL,&nbsp;https://(myhost)/Shibboleth.sso/Extra.</div>
<div>SP raises&nbsp;shibsp::ConfigurationException with saying&nbsp;&quot;Shibboleth handler invoked at an unconfigured location.&quot;</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 &quot;run&quot; log message.</div><div>Apparently the new Handler&#39;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&nbsp;&quot;Session&quot;&nbsp;type even in that situation.</div><div><br></div><div>This might be just my simple mistake, but I&#39;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>