[java-identity-provider] branch master updated: Fix tests.

Scott Cantor cantor.2 at osu.edu
Tue Jul 7 17:34:44 UTC 2020


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

scantor pushed a commit to branch master
in repository java-identity-provider.

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

The following commit(s) were added to refs/heads/master by this push:
       new  4ca0a9fc1 Fix tests.
4ca0a9fc1 is described below

commit 4ca0a9fc1bb08c50d875c9aff63e9354534f47c5
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jul 7 13:34:50 2020 -0400

    Fix tests.
---
 .../idp/authn/impl/HTPasswdCredentialValidatorTest.java       | 11 ++---------
 .../idp/authn/impl/JAASCredentialValidatorTest.java           |  6 ------
 .../idp/authn/impl/LDAPCredentialValidatorTest.java           | 11 -----------
 .../shibboleth/idp/authn/impl/ValidateCredentialsTest.java    |  3 ++-
 4 files changed, 4 insertions(+), 27 deletions(-)

diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/HTPasswdCredentialValidatorTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/HTPasswdCredentialValidatorTest.java
index 2925609b3..11f978091 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/HTPasswdCredentialValidatorTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/HTPasswdCredentialValidatorTest.java
@@ -202,7 +202,6 @@ public class HTPasswdCredentialValidatorTest extends BaseAuthenticationContextTe
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
         
-        Assert.assertNull(ac.getSubcontext(UsernamePasswordContext.class));
         Assert.assertNotNull(ac.getAuthenticationResult());
         Assert.assertEquals(ac.getAuthenticationResult().getSubject().getPrincipals(UsernamePrincipal.class).iterator()
                 .next().getName(), "PETER_THE_PRINCIPAL");
@@ -225,7 +224,6 @@ public class HTPasswdCredentialValidatorTest extends BaseAuthenticationContextTe
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
         
-        Assert.assertNull(ac.getSubcontext(UsernamePasswordContext.class));
         Assert.assertNotNull(ac.getAuthenticationResult());
         Assert.assertEquals(ac.getAuthenticationResult().getSubject().getPrincipals(UsernamePrincipal.class).iterator()
                 .next().getName(), "PETER_THE_PRINCIPAL");
@@ -247,7 +245,6 @@ public class HTPasswdCredentialValidatorTest extends BaseAuthenticationContextTe
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
         
-        Assert.assertNull(ac.getSubcontext(UsernamePasswordContext.class));
         Assert.assertNotNull(ac.getAuthenticationResult());
         Assert.assertEquals(ac.getAuthenticationResult().getSubject().getPrincipals(UsernamePrincipal.class).iterator()
                 .next().getName(), "PETER_THE_PRINCIPAL2");
@@ -269,7 +266,6 @@ public class HTPasswdCredentialValidatorTest extends BaseAuthenticationContextTe
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
         
-        Assert.assertNull(ac.getSubcontext(UsernamePasswordContext.class));
         Assert.assertNotNull(ac.getAuthenticationResult());
         Assert.assertEquals(ac.getAuthenticationResult().getSubject().getPrincipals(UsernamePrincipal.class).iterator()
                 .next().getName(), "PETER_THE_PRINCIPAL3");
@@ -282,7 +278,6 @@ public class HTPasswdCredentialValidatorTest extends BaseAuthenticationContextTe
         final AuthenticationContext ac = prc.getSubcontext(AuthenticationContext.class);
         ac.setAttemptedFlow(authenticationFlows.get(0));
 
-        validator.setRemoveContextAfterValidation(false);
         validator.initialize();
         
         action.initialize();
@@ -292,7 +287,6 @@ public class HTPasswdCredentialValidatorTest extends BaseAuthenticationContextTe
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
         
-        Assert.assertNotNull(ac.getSubcontext(UsernamePasswordContext.class));
         Assert.assertNotNull(ac.getAuthenticationResult());
         Assert.assertEquals(ac.getAuthenticationResult().getSubject().getPrincipals(UsernamePrincipal.class).iterator()
                 .next().getName(), "PETER_THE_PRINCIPAL");
@@ -309,9 +303,9 @@ public class HTPasswdCredentialValidatorTest extends BaseAuthenticationContextTe
         rpc.getPrincipalEvalPredicateFactoryRegistry().register(
                 TestPrincipal.class, "exact", new ExactPrincipalEvalPredicateFactory());
         rpc.setOperator("exact");
-        rpc.setRequestedPrincipals(Collections.<Principal>singletonList(new TestPrincipal("test1")));
+        rpc.setRequestedPrincipals(Collections.singletonList(new TestPrincipal("test1")));
 
-        validator.setSupportedPrincipals(Collections.<Principal>singletonList(new TestPrincipal("test1")));
+        validator.setSupportedPrincipals(Collections.singletonList(new TestPrincipal("test1")));
         validator.initialize();
         
         action.initialize();
@@ -321,7 +315,6 @@ public class HTPasswdCredentialValidatorTest extends BaseAuthenticationContextTe
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
         
-        Assert.assertNull(ac.getSubcontext(UsernamePasswordContext.class));
         Assert.assertNotNull(ac.getAuthenticationResult());
         Assert.assertEquals(ac.getAuthenticationResult().getSubject().getPrincipals(UsernamePrincipal.class).iterator()
                 .next().getName(), "PETER_THE_PRINCIPAL");
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/JAASCredentialValidatorTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/JAASCredentialValidatorTest.java
index 14607df40..d2df62f37 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/JAASCredentialValidatorTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/JAASCredentialValidatorTest.java
@@ -289,7 +289,6 @@ public class JAASCredentialValidatorTest extends BaseAuthenticationContextTest {
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
         
-        Assert.assertNull(ac.getSubcontext(UsernamePasswordContext.class));
         Assert.assertNotNull(ac.getAuthenticationResult());
         Assert.assertEquals(ac.getAuthenticationResult().getSubject().getPrincipals(UsernamePrincipal.class).iterator()
                 .next().getName(), "PETER_THE_PRINCIPAL");
@@ -305,7 +304,6 @@ public class JAASCredentialValidatorTest extends BaseAuthenticationContextTest {
         validator.setLoginConfigType("JavaLoginConfig");
         validator.setLoginConfigParameters(new URIParameter(URISupport.fileURIFromAbsolutePath(getCurrentDir()
                 + '/' + DATA_PATH + "jaas.config")));
-        validator.setRemoveContextAfterValidation(false);
         validator.initialize();
         
         action.initialize();
@@ -315,7 +313,6 @@ public class JAASCredentialValidatorTest extends BaseAuthenticationContextTest {
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
         
-        Assert.assertNotNull(ac.getSubcontext(UsernamePasswordContext.class));
         Assert.assertNotNull(ac.getAuthenticationResult());
         Assert.assertEquals(ac.getAuthenticationResult().getSubject().getPrincipals(UsernamePrincipal.class).iterator()
                 .next().getName(), "PETER_THE_PRINCIPAL");
@@ -348,7 +345,6 @@ public class JAASCredentialValidatorTest extends BaseAuthenticationContextTest {
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
         
-        Assert.assertNull(ac.getSubcontext(UsernamePasswordContext.class));
         Assert.assertNotNull(ac.getAuthenticationResult());
         Assert.assertEquals(ac.getAuthenticationResult().getSubject().getPrincipals(UsernamePrincipal.class).iterator()
                 .next().getName(), "PETER_THE_PRINCIPAL");
@@ -376,7 +372,6 @@ public class JAASCredentialValidatorTest extends BaseAuthenticationContextTest {
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
         
-        Assert.assertNull(ac.getSubcontext(UsernamePasswordContext.class));
         Assert.assertNotNull(ac.getAuthenticationResult());
         Assert.assertEquals(ac.getAuthenticationResult().getSubject().getPrincipals(UsernamePrincipal.class).iterator()
                 .next().getName(), "PETER_THE_PRINCIPAL");
@@ -401,7 +396,6 @@ public class JAASCredentialValidatorTest extends BaseAuthenticationContextTest {
 
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
-        Assert.assertNull(ac.getSubcontext(UsernamePasswordContext.class));
         
         Assert.assertNotNull(ac.getAuthenticationResult());
         Assert.assertEquals(ac.getAuthenticationResult().getSubject().getPrincipals(UsernamePrincipal.class).iterator()
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/LDAPCredentialValidatorTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/LDAPCredentialValidatorTest.java
index 11641623a..528eb41e8 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/LDAPCredentialValidatorTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/LDAPCredentialValidatorTest.java
@@ -473,8 +473,6 @@ public class LDAPCredentialValidatorTest extends BaseAuthenticationContextTest {
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
         
-        Assert.assertNull(ac.getSubcontext(UsernamePasswordContext.class));
-        
         AuthenticationErrorContext aec = ac.getSubcontext(AuthenticationErrorContext.class);
         Assert.assertNull(aec);
 
@@ -516,8 +514,6 @@ public class LDAPCredentialValidatorTest extends BaseAuthenticationContextTest {
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
 
-        Assert.assertNull(ac.getSubcontext(UsernamePasswordContext.class));
-
         AuthenticationErrorContext aec = ac.getSubcontext(AuthenticationErrorContext.class);
         Assert.assertNull(aec);
 
@@ -559,8 +555,6 @@ public class LDAPCredentialValidatorTest extends BaseAuthenticationContextTest {
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
 
-        Assert.assertNull(ac.getSubcontext(UsernamePasswordContext.class));
-
         AuthenticationErrorContext aec = ac.getSubcontext(AuthenticationErrorContext.class);
         Assert.assertNull(aec);
 
@@ -598,8 +592,6 @@ public class LDAPCredentialValidatorTest extends BaseAuthenticationContextTest {
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
         
-        Assert.assertNull(ac.getSubcontext(UsernamePasswordContext.class));
-
         AuthenticationErrorContext aec = ac.getSubcontext(AuthenticationErrorContext.class);
         Assert.assertNull(aec);
 
@@ -627,7 +619,6 @@ public class LDAPCredentialValidatorTest extends BaseAuthenticationContextTest {
         ac.setAttemptedFlow(authenticationFlows.get(0));
 
         validator.setAuthenticator(authenticator);
-        validator.setRemoveContextAfterValidation(false);
         validator.initialize();
         
         action.initialize();
@@ -636,8 +627,6 @@ public class LDAPCredentialValidatorTest extends BaseAuthenticationContextTest {
 
         final Event event = action.execute(src);
         ActionTestingSupport.assertProceedEvent(event);
-        
-        Assert.assertNotNull(ac.getSubcontext(UsernamePasswordContext.class));
     }
 
     private void doExtract() throws Exception {
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateCredentialsTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateCredentialsTest.java
index 99e4e70d3..002350f3e 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateCredentialsTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateCredentialsTest.java
@@ -111,7 +111,6 @@ public class ValidateCredentialsTest extends BaseAuthenticationContextTest {
         final LDAPCredentialValidator ldap = new LDAPCredentialValidator();
         ldap.setId("ldap");
         ldap.setAuthenticator(authenticator);
-        ldap.setRemoveContextAfterValidation(false);
         ldap.initialize();
 
         final HTPasswdCredentialValidator htpasswd = new HTPasswdCredentialValidator();
@@ -241,6 +240,7 @@ public class ValidateCredentialsTest extends BaseAuthenticationContextTest {
         AuthenticationContext ac = prc.getSubcontext(AuthenticationContext.class);
         ac.setAttemptedFlow(authenticationFlows.get(0));
         
+        action.setCleanupHook(new ValidateCredentials.UsernamePasswordCleanupHook());
         action.initialize();
 
         doExtract();
@@ -302,6 +302,7 @@ public class ValidateCredentialsTest extends BaseAuthenticationContextTest {
         ac.setAttemptedFlow(authenticationFlows.get(0));
         
         action.setRequireAll(true);
+        action.setCleanupHook(new ValidateCredentials.UsernamePasswordCleanupHook());
         action.initialize();
 
         doExtract();

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


More information about the commits mailing list