[java-idp-plugin-duo] 02/02: Fix flow test for use of passwordless view.

Scott Cantor cantor.2 at osu.edu
Wed Apr 17 14:52:59 UTC 2024


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

scantor pushed a commit to branch main
in repository java-idp-plugin-duo.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-duo.git;a=commit;h=bb3dfeefe6311aa086bb40248e4a362cbef61a8b

commit bb3dfeefe6311aa086bb40248e4a362cbef61a8b
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Apr 17 10:52:54 2024 -0400

    Fix flow test for use of passwordless view.
---
 .../idp/plugin/authn/duo/impl/DuoAuthnFlowTest.java  | 12 +++++-------
 .../conf/authn/duo-oidc-authn-test-beans.xml         | 20 ++++++++++++++++++++
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/idp-duo-impl/src/test/java/net/shibboleth/idp/plugin/authn/duo/impl/DuoAuthnFlowTest.java b/idp-duo-impl/src/test/java/net/shibboleth/idp/plugin/authn/duo/impl/DuoAuthnFlowTest.java
index 405375c8..8c60bd12 100644
--- a/idp-duo-impl/src/test/java/net/shibboleth/idp/plugin/authn/duo/impl/DuoAuthnFlowTest.java
+++ b/idp-duo-impl/src/test/java/net/shibboleth/idp/plugin/authn/duo/impl/DuoAuthnFlowTest.java
@@ -145,7 +145,10 @@ public class DuoAuthnFlowTest extends AbstractAuthnXmlFlowExecutionTests {
         // Inject the mock properties into the postconfig file as well as those loader directly by the builder
         loadBeanDefinitionsFromXmlFile(builderContext, 
                 new ClassPathResource("META-INF/net.shibboleth.idp/postconfig.xml"),
-                mockProperties);        
+                mockProperties);
+        loadBeanDefinitionsFromXmlFile(builderContext, 
+                new ClassPathResource("/conf/authn/duo-oidc-authn-test-beans.xml"),
+                mockProperties);
     }
     
     /**
@@ -254,8 +257,6 @@ public class DuoAuthnFlowTest extends AbstractAuthnXmlFlowExecutionTests {
      * 
      * @throws IOException on error
      */
-/*
- * TODO: fix up test when done
     @Test
     public void testDuoAuthnFlowToPasswordlessViewForPasswordlessIntegration() throws IOException {
         
@@ -288,9 +289,7 @@ public class DuoAuthnFlowTest extends AbstractAuthnXmlFlowExecutionTests {
        
         final ProfileRequestContext context = buildProfileRequestContext(false,true);
         // Add passwordless context to init passwordless flow
-        context.ensureSubcontext(AuthenticationContext.class).addSubcontext(new DuoPasswordlessContext());
-        // Add a username into the request for the passwordless flow to use
-        mockRequest.addParameter("j_username", "jdoe");
+        context.ensureSubcontext(AuthenticationContext.class).ensureSubcontext(DuoPasswordlessContext.class).setUsername("jdoe");
         
         final FlowExecution flowExecution = getFlowExecutionFactory().createFlowExecution(getFlowDefinition());  
         flowExecution.getConversationScope().put("opensamlProfileRequestContext", context);
@@ -299,7 +298,6 @@ public class DuoAuthnFlowTest extends AbstractAuthnXmlFlowExecutionTests {
         assertFlowExecutionActive();
         assertCurrentStateEquals("PasswordlessView");
     }
-    */
     
     
     /** Test the Duo flow up to the external authorization request using the dynamically selected
diff --git a/idp-duo-impl/src/test/resources/conf/authn/duo-oidc-authn-test-beans.xml b/idp-duo-impl/src/test/resources/conf/authn/duo-oidc-authn-test-beans.xml
new file mode 100644
index 00000000..34158777
--- /dev/null
+++ b/idp-duo-impl/src/test/resources/conf/authn/duo-oidc-authn-test-beans.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
+    xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p" xmlns:c="http://www.springframework.org/schema/c"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
+                           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+
+    default-init-method="initialize" default-destroy-method="destroy">
+
+    <bean id="shibboleth.PersistentCookieManager" class="net.shibboleth.shared.net.CookieManager" lazy-init="true"
+        p:httpServletRequestSupplier-ref="shibboleth.HttpServletRequestSupplier"
+        p:httpServletResponseSupplier-ref="shibboleth.HttpServletResponseSupplier"
+        p:secure="%{idp.cookie.secure:true}"
+        p:httpOnly="%{idp.cookie.httpOnly:true}"
+        p:cookieDomain="%{idp.cookie.domain:}"
+        p:cookiePath="%{idp.cookie.path:/}"
+        p:maxAge="%{idp.cookie.maxAge:31536000}" />
+
+</beans>

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


More information about the commits mailing list