SSPCPP-608 - Allow AuthnRequests to be signed at the SessionInitiator level
authorScott Cantor <cantor.2@osu.edu>
Wed, 11 May 2016 18:29:41 +0000 (14:29 -0400)
committerScott Cantor <cantor.2@osu.edu>
Wed, 11 May 2016 18:29:41 +0000 (14:29 -0400)
https://issues.shibboleth.net/jira/browse/SSPCPP-608

schemas/shibboleth-2.0-native-sp-config.xsd
shibsp/handler/impl/AbstractHandler.cpp
shibsp/handler/impl/SAML2LogoutInitiator.cpp

index 582ed12..7095253 100644 (file)
       <documentation>Used to ignore NoPassive errors in AssertionConsumerService endpoints</documentation>
     </annotation>
   </attribute>
+
+  <attribute name="signing" type="conf:bindingBoolean">
+    <annotation>
+      <documentation>Used to override signing property in SingleLogoutService/etc endpoints</documentation>
+    </annotation>
+  </attribute>
+
+  <attribute name="encryption" type="conf:bindingBoolean">
+    <annotation>
+      <documentation>Used to override encryption property in SingleLogoutService/etc endpoints</documentation>
+    </annotation>
+  </attribute>
   
   <attributeGroup name="SessionInitiatorGroup">
     <annotation>
     <attribute name="requestDelegation" type="boolean"/>
     <attribute name="target" type="anyURI"/>
     <attribute name="discoveryPolicy" type="conf:string"/>
+    <attribute name="signing" type="conf:bindingBoolean"/>
+    <attribute name="encryption" type="conf:bindingBoolean"/>    
     <anyAttribute namespace="##any" processContents="lax"/>
   </attributeGroup>
 
     <attribute name="outgoingBindings" type="conf:listOfURIs"/>
     <attribute name="template" type="anyURI"/>
     <attribute name="postArtifact" type="boolean"/>
+    <attribute name="signing" type="conf:bindingBoolean"/>
+    <attribute name="encryption" type="conf:bindingBoolean"/>    
     <anyAttribute namespace="##any" processContents="lax"/>
   </attributeGroup>
 
index 9b1c410..f364221 100644 (file)
@@ -517,7 +517,10 @@ long AbstractHandler::sendMessage(
 {
     const EntityDescriptor* entity = role ? dynamic_cast<const EntityDescriptor*>(role->getParent()) : nullptr;
     const PropertySet* relyingParty = application.getRelyingParty(entity);
-    pair<bool,const char*> flag = relyingParty->getString("signing");
+    pair<bool,const char*> flag = getString("signing",
+        !getElement() || XMLString::equals(getElement()->getNamespaceURI(), shibspconstants::SHIB2SPCONFIG_NS) ? nullptr : m_configNS.get());
+    if (!flag.first)
+        flag = relyingParty->getString("signing");
     if (SPConfig::shouldSignOrEncrypt(flag.first ? flag.second : defaultSigningProperty, destination, encoder.isUserAgentPresent())) {
         CredentialResolver* credResolver = application.getCredentialResolver();
         if (credResolver) {
index 37c150b..d70a991 100644 (file)
@@ -518,7 +518,9 @@ auto_ptr<LogoutRequest> SAML2LogoutInitiator::buildRequest(
     }
 
     const NameID* nameid = session.getNameID();
-    pair<bool,const char*> flag = relyingParty->getString("encryption");
+    pair<bool, const char*> flag = getString("encryption");
+    if (!flag.first)
+        flag = relyingParty->getString("encryption");
     auto_ptr_char dest(endpoint);
     if (SPConfig::shouldSignOrEncrypt(flag.first ? flag.second : "conditional", dest.get(), encoder != nullptr)) {
         try {