[java-identity-provider] branch main updated: Fix tests resulting from error mapping change.

Scott Cantor cantor.2 at osu.edu
Wed Dec 7 17:52:26 UTC 2022


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

scantor 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=75f499e8c8e9fa9eddd99db6b0c25e72b4f881a3

The following commit(s) were added to refs/heads/main by this push:
     new 75f499e8c Fix tests resulting from error mapping change.
75f499e8c is described below

commit 75f499e8c8e9fa9eddd99db6b0c25e72b4f881a3
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Dec 7 12:52:23 2022 -0500

    Fix tests resulting from error mapping change.
---
 .../idp/authn/impl/LDAPCredentialValidatorTest.java         | 13 +++++++++----
 .../shibboleth/idp/authn/impl/ValidateCredentialsTest.java  |  3 ++-
 2 files changed, 11 insertions(+), 5 deletions(-)

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 984127870..01855af8d 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
@@ -171,8 +171,10 @@ public class LDAPCredentialValidatorTest extends BaseAuthenticationContextTest {
         final Event event = action.execute(src);
         Assert.assertNull(ac.getAuthenticationResult());
         Assert.assertNull(ac.getSubcontext(LDAPResponseContext.class));
-        Assert.assertNull(ac.getSubcontext(AuthenticationErrorContext.class));
         ActionTestingSupport.assertEvent(event, AuthnEventIds.NO_CREDENTIALS);
+        final AuthenticationErrorContext aec = ac.getSubcontext(AuthenticationErrorContext.class);
+        Assert.assertNotNull(aec);
+        Assert.assertTrue(aec.isClassifiedError(AuthnEventIds.NO_CREDENTIALS));
     }
 
     @Test public void testUnmatchedUser() throws ComponentInitializationException {
@@ -242,11 +244,12 @@ public class LDAPCredentialValidatorTest extends BaseAuthenticationContextTest {
 
         Assert.assertNull(ac.getAuthenticationResult());
         Assert.assertNull(ac.getSubcontext(LDAPResponseContext.class));
-        AuthenticationErrorContext aec = ac.getSubcontext(AuthenticationErrorContext.class);
+        final AuthenticationErrorContext aec = ac.getSubcontext(AuthenticationErrorContext.class);
         Assert.assertNotNull(aec);
         ActionTestingSupport.assertEvent(event, AuthnEventIds.AUTHN_EXCEPTION);
         Assert.assertEquals(aec.getExceptions().size(), 1);
-        Assert.assertEquals(aec.getClassifiedErrors().size(), 0);
+        Assert.assertEquals(aec.getClassifiedErrors().size(), 1);
+        Assert.assertTrue(aec.isClassifiedError(AuthnEventIds.AUTHN_EXCEPTION));
     }
 
     @Test public void testBadUsername() throws ComponentInitializationException {
@@ -294,8 +297,10 @@ public class LDAPCredentialValidatorTest extends BaseAuthenticationContextTest {
         final Event event = action.execute(src);
         Assert.assertNull(ac.getAuthenticationResult());
         Assert.assertNull(ac.getSubcontext(LDAPResponseContext.class));
-        Assert.assertNull(ac.getSubcontext(AuthenticationErrorContext.class));
         ActionTestingSupport.assertEvent(event, AuthnEventIds.INVALID_CREDENTIALS);
+        final AuthenticationErrorContext aec = ac.getSubcontext(AuthenticationErrorContext.class);
+        Assert.assertNotNull(aec);
+        Assert.assertTrue(aec.isClassifiedError(AuthnEventIds.INVALID_CREDENTIALS));
     }
 
     @Test public void testBadPassword() throws ComponentInitializationException {
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 2809bce15..bc616a8c8 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
@@ -201,8 +201,9 @@ public class ValidateCredentialsTest extends BaseAuthenticationContextTest {
         AuthenticationErrorContext aec = ac.getSubcontext(AuthenticationErrorContext.class);
         Assert.assertNotNull(aec);
         ActionTestingSupport.assertEvent(event, "InvalidPassword");
-        Assert.assertEquals(aec.getClassifiedErrors().size(), 1);
+        Assert.assertEquals(aec.getClassifiedErrors().size(), 2);
         Assert.assertTrue(aec.isClassifiedError("InvalidPassword"));
+        Assert.assertTrue(aec.isClassifiedError(AuthnEventIds.INVALID_CREDENTIALS));
     }
 
     @Test public void testAuthorized() throws ComponentInitializationException {

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


More information about the commits mailing list