[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/saml2/profile/delegati...

noreply at shibboleth.net noreply at shibboleth.net
Tue Oct 20 20:22:20 EDT 2015


Author: putmanb
Date: Tue Oct 20 20:22:20 2015
New Revision: 7839

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7839&view=rev
Log:
IDP-672: Create Action(s) and supporting code to issue SAML 2 Assertions decorated for delegation

The absence of a SAMLMetadataContext or RoleDescriptor therein should not be fatal, should just result in no delegation.
This is the unverified relying party case.

Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContext.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContextTest.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContext.java?rev=7839&r1=7838&r2=7839&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContext.java	(original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContext.java	Tue Oct 20 20:22:20 2015
@@ -313,15 +313,13 @@
     protected boolean doPreExecuteMetadata(@Nonnull final ProfileRequestContext profileRequestContext) {
         SAMLMetadataContext samlMetadataContext = samlMetadataContextLookupStrategy.apply(profileRequestContext);
         if (samlMetadataContext == null) {
-            log.warn("No SAMLMetadataContext was available");
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
+            log.debug("No SAMLMetadataContext was available, skipping further delegation processing");
             return false;
         }
         
         roleDescriptor = samlMetadataContext.getRoleDescriptor();
         if (roleDescriptor == null) {
-            log.warn("No RoleDescriptor was available");
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
+            log.debug("No RoleDescriptor was available, skipping further delegation processing");
             return false;
         }
         

Modified: trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContextTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContextTest.java?rev=7839&r1=7838&r2=7839&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContextTest.java	(original)
+++ trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/PopulateDelegationContextTest.java	Tue Oct 20 20:22:20 2015
@@ -89,6 +89,8 @@
     
     private int numKeys = 3;
     
+    private SAMLPeerEntityContext samlPeerContext;
+    
     private SAMLMetadataContext samlMetadataContext;
     
     private PopulateDelegationContext action;
@@ -148,11 +150,11 @@
         prc = new WebflowRequestContextProfileRequestContextLookup().apply(rc);
 
         RelyingPartyContext rpcContext = prc.getSubcontext(RelyingPartyContext.class);
-        SAMLPeerEntityContext peerContext = rpcContext.getSubcontext(SAMLPeerEntityContext.class, true);
-        peerContext.setEntityId(ActionTestingSupport.INBOUND_MSG_ISSUER);
-        peerContext.setRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
-        rpcContext.setRelyingPartyIdContextTree(peerContext);
-        samlMetadataContext = peerContext.getSubcontext(SAMLMetadataContext.class, true);
+        samlPeerContext = rpcContext.getSubcontext(SAMLPeerEntityContext.class, true);
+        samlPeerContext.setEntityId(ActionTestingSupport.INBOUND_MSG_ISSUER);
+        samlPeerContext.setRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
+        rpcContext.setRelyingPartyIdContextTree(samlPeerContext);
+        samlMetadataContext = samlPeerContext.getSubcontext(SAMLMetadataContext.class, true);
         samlMetadataContext.setRoleDescriptor(buildSPSSODescriptor());
         
         MetadataCredentialResolver mcr = new MetadataCredentialResolver();
@@ -223,6 +225,30 @@
         action.initialize();
         final Event result = action.execute(rc);
         ActionTestingSupport.assertEvent(result, EventIds.INVALID_PROFILE_CTX);
+        
+        DelegationContext delegationContext = prc.getSubcontext(DelegationContext.class);
+        Assert.assertNull(delegationContext);
+    }
+    
+    @Test
+    public void testNoMetadataContext() throws Exception {
+        samlPeerContext.removeSubcontext(SAMLMetadataContext.class);
+
+        action.initialize();
+        final Event result = action.execute(rc);
+        ActionTestingSupport.assertProceedEvent(result);
+        

[... 15 lines stripped ...]


More information about the commits mailing list