New Shibboleth SP Handler using extension

Daisuke Miyakawa d.miyakawa at gmail.com
Tue Jan 15 06:20:52 EST 2013


Hi Shibboleth,

I have a question about Shibboleth SP extension:
  Can I introduce a new SP Handler implementation, using SP's extension
mechanism?

Detail:
I want to introduce another Handler to let the SP return something
meaningful, aside from SAML protocol.
I tried implementing it, which was not successful.

My current implementation looks like this:

----
(include .. namespace ..)

namespace test {
    class SHIBSP_DLLLOCAL ExtraHandler : public AbstractHandler {
    public:
        ExtraHandler(const DOMElement* e, const char* appId);
        virtual ~ExtraHandler() {}

        std::pair<bool,long> run(SPRequest& request, bool isHandler=true)
const;
    private:
    };

    Handler* SHIBSP_DLLLOCAL ExtraHandlerFactory(const pair<const
DOMElement*,const char*>& p) {
        return new ExtraHandler(p.first, p.second);
    }
}
using namespace test;

ExtraHandler::ExtraHandler(const DOMElement* e, const char* appId)
    : AbstractHandler(e,
xmltooling::logging::Category::getInstance(TEST_EXTENSION ".ExtraHandler"))
{
    m_log.debug("(constructor): appId=%s", appId);
}

std::pair<bool,long> ExtraHandler::run(SPRequest& request, bool isHandler)
const {
    m_log.debug("run");

    HTTPResponse& response = request;
    istringstream iss("<html>hello</html>");
    return make_pair(true, response.sendResponse(iss));
}

..

extern "C" int xmltooling_extension_init(void*)
{
   SPConfig& conf = SPConfig::getConfig();
   conf.HandlerManager.registerFactory("Extra", ExtraHandlerFactory);
}
----

Relevant part of shibboleth2.xml looks like this
---
        <Sessions lifetime="28800" timeout="3600" checkAddress="false"
relayState="ss:mem" handlerSSL="false">
            <SSO discoveryProtocol="SAMLDS" discoveryURL="https://
(ds-host)/shibboleth-ds">
              SAML2 SAML1
            </SSO>

            <Logout>SAML2 Local</Logout>
            <Handler type="MetadataGenerator" Location="/Metadata"
signing="false"/>
            <Handler type="Status" Location="/Status" acl="127.0.0.1"/>
            <Handler type="Session" Location="/Session"
showAttributeValues="true"/>
            <Handler type="DiscoveryFeed" Location="/DiscoFeed"/>

            <!-- Handler from the custom extension.. -->
            <Handler type="Extra" Location="/Extra"/>        <-- ...  -->
            <Handler type="Session" Location="/Extra2"/>  <-- for debugging
-->

        </Sessions>
----

After putting the shared object in a right directory and rebooting shibd,
I successfully saw "(constructor): appId=default" log message in my
shibd.log, which is
embedded in my implementation of ExtraHandler (as you can see above).
At this point, I assumed ExtraHandler was detected and loaded by the SP
appropriately.

After that, however, I couldn't access to the relevant URL, https://
(myhost)/Shibboleth.sso/Extra.
SP raises shibsp::ConfigurationException with saying "Shibboleth handler
invoked at an unconfigured location."
though SP already appears to know the Handler is there, according to the
previous log message.
No relevant error log was seen in shibd.log, while ideally I should be
seeing "run" log message.
Apparently the new Handler's run() member function was not called at all.

https://(myhost)/Shibboleth.sso/Extra2, which was appended just for
debugging in shibboleth2.xml, was
effective with "Session" type even in that situation.

This might be just my simple mistake, but I'd like to know if this is even
possible.
I kind of suspect it may not.

Thanks,

-- 
Daisuke Miyakawa (宮川大輔)
d.miyakawa at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/users/attachments/20130115/8910494c/attachment.html 


More information about the users mailing list