[java-identity-provider] branch main updated: IDP-2295 - Make LDAP authenticator immutable

Daniel Fisher dfisher at vt.edu
Mon Mar 31 03:21:57 UTC 2025


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

dfisher 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=53b8a03d9b5d0e25442e7407c51c4ce4048c9ef3

The following commit(s) were added to refs/heads/main by this push:
     new 53b8a03d9 IDP-2295 - Make LDAP authenticator immutable
53b8a03d9 is described below

commit 53b8a03d9b5d0e25442e7407c51c4ce4048c9ef3
Author: Daniel Fisher <dfisher at vt.edu>
AuthorDate: Mon Jul 29 13:06:18 2024 -0400

    IDP-2295 - Make LDAP authenticator immutable
    
    https://shibboleth.atlassian.net/browse/IDP-2295
---
 .../idp/authn/config/LDAPAuthenticationFactoryBean.java   |  1 +
 .../authn/config/LDAPAuthenticationFactoryBeanTest.java   | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/config/LDAPAuthenticationFactoryBean.java b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/config/LDAPAuthenticationFactoryBean.java
index 20e300ec9..19f9390c0 100644
--- a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/config/LDAPAuthenticationFactoryBean.java
+++ b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/config/LDAPAuthenticationFactoryBean.java
@@ -1053,6 +1053,7 @@ public class LDAPAuthenticationFactoryBean extends AbstractFactoryBean<Authentic
             authenticator.setResponseHandlers(new FreeIPAAuthenticationResponseHandler(accountStateExpirationPeriod,
                     accountStateWarningPeriod, accountStateLoginFailures));
         }
+        authenticator.freeze();
         log.debug("Created {} from {}", authenticator, this);
         return authenticator;
     }
diff --git a/idp-authn-api/src/test/java/net/shibboleth/idp/authn/config/LDAPAuthenticationFactoryBeanTest.java b/idp-authn-api/src/test/java/net/shibboleth/idp/authn/config/LDAPAuthenticationFactoryBeanTest.java
index 6b5f84e57..744902a5f 100644
--- a/idp-authn-api/src/test/java/net/shibboleth/idp/authn/config/LDAPAuthenticationFactoryBeanTest.java
+++ b/idp-authn-api/src/test/java/net/shibboleth/idp/authn/config/LDAPAuthenticationFactoryBeanTest.java
@@ -121,6 +121,21 @@ public class LDAPAuthenticationFactoryBeanTest {
         Assert.assertFalse(response.isSuccess());
     }
 
+    @Test public void testAuthenticatorFreeze() throws Exception {
+        try {
+            authenticator.setAuthenticationHandler(null);
+            Assert.fail("Should have thrown exception");
+        } catch (Exception e) {
+            Assert.assertEquals(e.getClass(), IllegalStateException.class);
+        }
+        try {
+            authenticator.setDnResolver(null);
+            Assert.fail("Should have thrown exception");
+        } catch (Exception e) {
+            Assert.assertEquals(e.getClass(), IllegalStateException.class);
+        }
+    }
+
     private AuthenticationRequest createAuthenticationRequest(final String username, final String password) {
         final UsernamePasswordContext upc = new UsernamePasswordContext();
         upc.setUsername(username);

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


More information about the commits mailing list