[java-identity-provider] 05/06: IDP-1457 Remove Legacy (V2) scripting support for attribute resolver.

Rod Widdowson rdw at steadingsoftware.com
Wed Jun 1 13:51:38 UTC 2022


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=4d44059d9e455cf2135817876e3508425f23c35b

commit 4d44059d9e455cf2135817876e3508425f23c35b
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Jun 1 14:38:40 2022 +0100

    IDP-1457 Remove Legacy (V2) scripting support for attribute resolver.
    
    https://shibboleth.atlassian.net/browse/IDP-1457
    
    Stop adding V2 legacy context to Scripted environment.
    Stop testing for same
---
 .../ad/impl/ScriptedAttributeDefinition.java       | 19 +++++---------
 .../resolver/ad/impl/ScriptedAttributeTest.java    | 30 ----------------------
 2 files changed, 6 insertions(+), 43 deletions(-)

diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeDefinition.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeDefinition.java
index 42a9e4943..d2cefeccf 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeDefinition.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeDefinition.java
@@ -29,6 +29,12 @@ import javax.script.ScriptContext;
 import javax.script.ScriptException;
 import javax.security.auth.Subject;
 
+import org.opensaml.messaging.context.navigate.ChildContextLookup;
+import org.opensaml.messaging.context.navigate.ParentContextLookup;
+import org.opensaml.profile.context.ProfileRequestContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import net.shibboleth.idp.attribute.IdPAttribute;
 import net.shibboleth.idp.attribute.IdPAttributeValue;
 import net.shibboleth.idp.attribute.resolver.AbstractAttributeDefinition;
@@ -44,14 +50,6 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
 import net.shibboleth.utilities.java.support.scripting.AbstractScriptEvaluator;
 import net.shibboleth.utilities.java.support.scripting.EvaluableScript;
 
-import org.opensaml.messaging.context.navigate.ChildContextLookup;
-import org.opensaml.messaging.context.navigate.ParentContextLookup;
-import org.opensaml.profile.context.ProfileRequestContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import edu.internet2.middleware.shibboleth.common.attribute.provider.V2SAMLProfileRequestContext;
-
 /**
  * An {@link net.shibboleth.idp.attribute.resolver.AttributeDefinition} that executes a script in order to populate the
  * values of the generated attribute.
@@ -270,11 +268,6 @@ public class ScriptedAttributeDefinition extends AbstractAttributeDefinition {
                 }
             }
 
-            log.debug("{} Adding emulated V2 request context to script context", getLogPrefix());
-            scriptContext.setAttribute("requestContext",
-                    new V2SAMLProfileRequestContext((AttributeResolutionContext) input[0], getId()),
-                    ScriptContext.ENGINE_SCOPE);
-
             for (final Entry<String,List<IdPAttributeValue>> dependencyAttribute : dependencyAttributes.entrySet()) {
                 log.trace("{} Adding dependent attribute '{}' with the following values to the script context: {}",
                         new Object[] {getLogPrefix(), dependencyAttribute.getKey(), dependencyAttribute.getValue(),});
diff --git a/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java b/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java
index 5f3700ae8..3add282aa 100644
--- a/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java
+++ b/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java
@@ -584,36 +584,6 @@ public class ScriptedAttributeTest extends XMLObjectBaseTestCase {
 
     }
 
-    @Test public void v2Context() throws IOException, ComponentInitializationException, ResolutionException,
-            ScriptException {
-
-        final ScriptedAttributeDefinition scripted = new ScriptedAttributeDefinition();
-        scripted.setId("scripted");
-        scripted.setScript(getScript("requestContext.script"));
-        scripted.initialize();
-
-        final IdPAttribute result = scripted.resolve(generateContext());
-        final HashSet<IdPAttributeValue> set = new HashSet<>(result.getValues());
-        assertEquals(set.size(), 3);
-        assertTrue(set.contains(new StringAttributeValue(TestSources.PRINCIPAL_ID)));
-        assertTrue(set.contains(new StringAttributeValue(TestSources.IDP_ENTITY_ID)));
-        assertTrue(set.contains(new StringAttributeValue(TestSources.SP_ENTITY_ID)));
-
-    }
-
-    @Test public void unimplementedV2Context() throws IOException, ComponentInitializationException,
-            ResolutionException, ScriptException {
-
-        final ScriptedAttributeDefinition scripted = new ScriptedAttributeDefinition();
-        scripted.setId("scripted");
-        scripted.setScript(getScript("requestContextUnimplemented.script"));
-        scripted.initialize();
-
-        final IdPAttribute result = scripted.resolve(generateContext());
-        assertEquals(result.getValues().iterator().next(), new StringAttributeValue("AllDone"));
-
-    }
-
     private static AttributeResolutionContext generateContext() {
         final AttributeResolutionContext ctx = TestSources.createResolutionContext(TestSources.PRINCIPAL_ID, TestSources.IDP_ENTITY_ID,
                 TestSources.SP_ENTITY_ID);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list