X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=shibsp%2Fhandler%2Fimpl%2FSAMLDSSessionInitiator.cpp;h=6084d76560f3aa638d998c2683da52ef7a9ade10;hb=1d41a3684f54944c8274262d6b577485ecca4319;hp=20b1ff4a1d16ca3746d821ee94dda875bfae0c94;hpb=5581a7c4003e40a4d80fb0e093803aefd2abe340;p=shibboleth%2Fsp.git diff --git a/shibsp/handler/impl/SAMLDSSessionInitiator.cpp b/shibsp/handler/impl/SAMLDSSessionInitiator.cpp index 20b1ff4..6084d76 100644 --- a/shibsp/handler/impl/SAMLDSSessionInitiator.cpp +++ b/shibsp/handler/impl/SAMLDSSessionInitiator.cpp @@ -28,6 +28,7 @@ #include "handler/SessionInitiator.h" #include +#include #include using namespace shibsp; @@ -35,6 +36,10 @@ using namespace opensaml; using namespace xmltooling; using namespace std; +#ifndef SHIBSP_LITE +using namespace opensaml::saml2md; +#endif + namespace shibsp { #if defined (_MSC_VER) @@ -46,7 +51,11 @@ namespace shibsp { { public: SAMLDSSessionInitiator(const DOMElement* e, const char* appId) - : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".SessionInitiator.SAMLDS")), m_url(NULL), m_returnParam(NULL) { + : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".SessionInitiator.SAMLDS")), m_url(NULL), m_returnParam(NULL) +#ifndef SHIBSP_LITE + ,m_discoNS("urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol") +#endif + { pair url = getString("URL"); if (!url.first) throw ConfigurationException("SAMLDS SessionInitiator requires a URL property."); @@ -59,9 +68,36 @@ namespace shibsp { pair run(SPRequest& request, const char* entityID=NULL, bool isHandler=true) const; +#ifndef SHIBSP_LITE + void generateMetadata(SPSSODescriptor& role, const char* handlerURL) const { + static const XMLCh LOCAL_NAME[] = UNICODE_LITERAL_17(D,i,s,c,o,v,e,r,y,R,e,s,p,o,n,s,e); + const char* loc = getString("Location").second; + string hurl(handlerURL); + if (*loc != '/') + hurl += '/'; + hurl += loc; + auto_ptr_XMLCh widen(hurl.c_str()); + ElementProxy* ep = new AnyElementImpl(m_discoNS.get(), LOCAL_NAME); + ep->setAttribute(QName(NULL,EndpointType::LOCATION_ATTRIB_NAME), widen.get()); + ep->setAttribute(QName(NULL,EndpointType::BINDING_ATTRIB_NAME), getXMLString("Binding").second); + pair ix = getXMLString("index"); + ep->setAttribute(QName(NULL,IndexedEndpointType::INDEX_ATTRIB_NAME), ix.first ? ix.second : xmlconstants::XML_ONE); + + Extensions* ext = role.getExtensions(); + if (!ext) { + ext = ExtensionsBuilder::buildExtensions(); + role.setExtensions(ext); + } + ext->getUnknownXMLObjects().push_back(ep); + } +#endif + private: const char* m_url; const char* m_returnParam; +#ifndef SHIBSP_LITE + auto_ptr_XMLCh m_discoNS; +#endif }; #if defined (_MSC_VER)