From 580d548cdf33a797ee4a2794c755735406d6b372 Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Sun, 30 Sep 2007 03:44:01 +0000 Subject: [PATCH 1/1] Attempt at a metadata generation handler. --- adfs/adfs.cpp | 26 +- configs/shibboleth2.xml.in | 3 + schemas/shibboleth-2.0-native-sp-config.xsd | 1 + shibsp/Application.h | 7 + shibsp/Makefile.am | 1 + shibsp/handler/AssertionConsumerService.h | 22 +- shibsp/handler/Handler.h | 16 ++ shibsp/handler/impl/AbstractHandler.cpp | 4 +- shibsp/handler/impl/AssertionConsumerService.cpp | 41 ++- shibsp/handler/impl/MetadataGenerator.cpp | 303 +++++++++++++++++++++++ shibsp/handler/impl/SAML1Consumer.cpp | 9 +- shibsp/handler/impl/SAML2Consumer.cpp | 7 +- shibsp/handler/impl/SAML2Logout.cpp | 16 ++ shibsp/impl/XMLServiceProvider.cpp | 14 +- shibsp/shibsp-lite.vcproj | 4 + shibsp/shibsp.vcproj | 4 + 16 files changed, 449 insertions(+), 29 deletions(-) create mode 100644 shibsp/handler/impl/MetadataGenerator.cpp diff --git a/adfs/adfs.cpp b/adfs/adfs.cpp index 116fa02..6403441 100644 --- a/adfs/adfs.cpp +++ b/adfs/adfs.cpp @@ -153,8 +153,15 @@ namespace { {} virtual ~ADFSConsumer() {} - private: #ifndef SHIBSP_LITE + void generateMetadata(SPSSODescriptor& role, const char* handlerURL) const { + AssertionConsumerService::generateMetadata(role, handlerURL); + role.addSupport(m_protocol.get()); + } + + auto_ptr_XMLCh m_protocol; + + private: string implementProtocol( const Application& application, const HTTPRequest& httpRequest, @@ -162,7 +169,6 @@ namespace { const PropertySet* settings, const XMLObject& xmlObject ) const; - auto_ptr_XMLCh m_protocol; #endif }; @@ -220,6 +226,22 @@ namespace { pair run(SPRequest& request, bool isHandler=true) const; +#ifndef SHIBSP_LITE + void generateMetadata(SPSSODescriptor& role, const char* handlerURL) const { + m_login.generateMetadata(role, handlerURL); + const char* loc = getString("Location").second; + string hurl(handlerURL); + if (*loc != '/') + hurl += '/'; + hurl += loc; + auto_ptr_XMLCh widen(hurl.c_str()); + SingleLogoutService* ep = SingleLogoutServiceBuilder::buildSingleLogoutService(); + ep->setLocation(widen.get()); + ep->setBinding(m_login.m_protocol.get()); + role.getSingleLogoutServices().push_back(ep); + } +#endif + private: ADFSConsumer m_login; }; diff --git a/configs/shibboleth2.xml.in b/configs/shibboleth2.xml.in index 7cc75e4..5825d7f 100644 --- a/configs/shibboleth2.xml.in +++ b/configs/shibboleth2.xml.in @@ -178,6 +178,9 @@ + + +