[java-identity-provider COMMIT] in /trunk/idp-conf/src/test: java/net/shibboleth/idp/test/flows/AbstractFlowTest.java...

noreply at shibboleth.net noreply at shibboleth.net
Wed Dec 17 00:18:51 EST 2014


Author: dfisher
Date: Wed Dec 17 00:18:50 2014
New Revision: 7128

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7128&view=rev
Log:
IDP-444
Refactor flow tests to use Password authentication instead of IPAddress.

Added:
    trunk/idp-conf/src/test/resources/conf/ldap.properties
    trunk/idp-conf/src/test/resources/test/test-ldap.pem
Modified:
    trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/AbstractFlowTest.java
    trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1TestResponseValidator.java
    trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml2/SAML2TestResponseValidator.java

Modified: trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/AbstractFlowTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/AbstractFlowTest.java?rev=7128&r1=7127&r2=7128&view=diff
==============================================================================
--- trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/AbstractFlowTest.java (original)
+++ trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/AbstractFlowTest.java Wed Dec 17 00:18:50 2014
@@ -18,9 +18,6 @@
 package net.shibboleth.idp.test.flows;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -34,7 +31,6 @@
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
 import net.shibboleth.utilities.java.support.logic.Constraint;
 import net.shibboleth.utilities.java.support.net.HttpServletRequestResponseContext;
-import net.shibboleth.utilities.java.support.net.IPRange;
 import net.shibboleth.utilities.java.support.security.IdentifierGenerationStrategy;
 import net.shibboleth.utilities.java.support.security.Type4UUIDIdentifierGenerationStrategy;
 import net.shibboleth.utilities.java.support.xml.ParserPool;
@@ -84,6 +80,7 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.BeforeTest;
 
+import com.google.common.net.HttpHeaders;
 import com.unboundid.ldap.sdk.LDAPException;
 
 /**
@@ -179,6 +176,7 @@
 
     static {
         setIdPHomeProperty();
+        setAuthnFlowsProperty();
     }
 
     /**
@@ -188,6 +186,13 @@
         System.setProperty("idp.home", "classpath:");
     }
 
+    /**
+     * Sets the 'idp.authn.flows' property to "Password".
+     */
+    public static void setAuthnFlowsProperty() {
+        System.setProperty("idp.authn.flows", "Password");
+    }
+    
     /**
      * {@link HttpServletRequestResponseContext#clearCurrent()}
      */
@@ -208,6 +213,8 @@
      */
     @BeforeMethod public void initializeMocks() {
         request = new MockHttpServletRequest();
+        // add basic auth header for jdoe:changeit, see test-ldap.ldif
+        request.addHeader(HttpHeaders.AUTHORIZATION, "Basic amRvZTpjaGFuZ2VpdA==");
         response = new MockHttpServletResponse();
         externalContext = new MockExternalContext();
         externalContext.setNativeRequest(request);
@@ -383,25 +390,6 @@
     }
 
     /**
-     * Configure IP address based authentication by assembling the {@link #IP_ADDRESS_AUTHN_FLOW_ID} flow for the first
-     * time and overriding the map of allowed principals to IP ranges via the {@link #IP_ADDRESS_AUTHN_MAP_BEAN_NAME}
-     * bean.
-     */
-    @BeforeMethod(dependsOnMethods = {"initializeFlowExecutor"}) public void overrideIPBasedAuthn() {
-        
-        System.setProperty("idp.authn.flows", "IPAddress|Password");
-        
-        final Flow flow = getFlow(IP_ADDRESS_AUTHN_FLOW_ID);
-
-        final Map map = flow.getApplicationContext().getBean(IP_ADDRESS_AUTHN_MAP_BEAN_NAME, Map.class);
-
-        final List<IPRange> ipRanges = new ArrayList<IPRange>(2);
-        ipRanges.add(IPRange.parseCIDRBlock("127.0.0.1/24"));
-        ipRanges.add(IPRange.parseCIDRBlock("::1/128"));
-        map.put("jdoe", ipRanges);
-    }
-
-    /**
      * Add flows defined in a child flow definition registry to its parent registry.
      * @param flowID the flow ID
      * @param childRegistryID the child flow registry ID

Modified: trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1TestResponseValidator.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1TestResponseValidator.java?rev=7128&r1=7127&r2=7128&view=diff
==============================================================================
--- trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1TestResponseValidator.java (original)
+++ trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1TestResponseValidator.java Wed Dec 17 00:18:50 2014
@@ -56,7 +56,7 @@
     @Nonnull public String spEntityID = "https://sp.example.org";
 
     /** Expected authentication method. */
-    @Nonnull public String authenticationMethod = AuthenticationStatement.UNSPECIFIED_AUTHN_METHOD;

[... 20 lines stripped ...]


More information about the commits mailing list