This is an automated email from the ASF dual-hosted git repository.

lprimak pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shiro.git

commit c3cfcf752d784444497aa60abd305aa135329c5b
Author: lprimak <[email protected]>
AuthorDate: Wed Aug 19 21:51:05 2026 -0500

    bugfix: removed unnecessary setCredentialsMatcher() call in DefaultLdapRealm
---
 core/src/main/java/org/apache/shiro/realm/ldap/DefaultLdapRealm.java  | 3 ---
 .../test/java/org/apache/shiro/realm/ldap/DefaultLdapRealmTest.java   | 4 ++--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git 
a/core/src/main/java/org/apache/shiro/realm/ldap/DefaultLdapRealm.java 
b/core/src/main/java/org/apache/shiro/realm/ldap/DefaultLdapRealm.java
index b0a019979..4856b3d07 100644
--- a/core/src/main/java/org/apache/shiro/realm/ldap/DefaultLdapRealm.java
+++ b/core/src/main/java/org/apache/shiro/realm/ldap/DefaultLdapRealm.java
@@ -22,7 +22,6 @@ import org.apache.shiro.authc.AuthenticationException;
 import org.apache.shiro.authc.AuthenticationInfo;
 import org.apache.shiro.authc.AuthenticationToken;
 import org.apache.shiro.authc.SimpleAuthenticationInfo;
-import org.apache.shiro.authc.credential.AllowAllCredentialsMatcher;
 import org.apache.shiro.authz.AuthorizationException;
 import org.apache.shiro.authz.AuthorizationInfo;
 import org.apache.shiro.ldap.UnsupportedAuthenticationMechanismException;
@@ -109,8 +108,6 @@ public class DefaultLdapRealm extends AuthorizingRealm {
      * {@link JndiLdapContextFactory}.
      */
     public DefaultLdapRealm() {
-        //Credentials Matching is not necessary - the LDAP directory will do 
it automatically:
-        setCredentialsMatcher(new AllowAllCredentialsMatcher());
         //Any Object principal and Object credentials may be passed to the 
LDAP provider, so accept any token:
         setAuthenticationTokenClass(AuthenticationToken.class);
         this.contextFactory = new JndiLdapContextFactory();
diff --git 
a/core/src/test/java/org/apache/shiro/realm/ldap/DefaultLdapRealmTest.java 
b/core/src/test/java/org/apache/shiro/realm/ldap/DefaultLdapRealmTest.java
index f2ab25f5d..ea1be3403 100644
--- a/core/src/test/java/org/apache/shiro/realm/ldap/DefaultLdapRealmTest.java
+++ b/core/src/test/java/org/apache/shiro/realm/ldap/DefaultLdapRealmTest.java
@@ -21,7 +21,7 @@ package org.apache.shiro.realm.ldap;
 import org.apache.shiro.authc.AuthenticationException;
 import org.apache.shiro.authc.AuthenticationToken;
 import org.apache.shiro.authc.UsernamePasswordToken;
-import org.apache.shiro.authc.credential.AllowAllCredentialsMatcher;
+import org.apache.shiro.authc.credential.SimpleCredentialsMatcher;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -61,7 +61,7 @@ public class DefaultLdapRealmTest {
 
     @Test
     void testDefaultInstance() {
-        assertThat(realm.getCredentialsMatcher() instanceof 
AllowAllCredentialsMatcher).isTrue();
+        assertThat(realm.getCredentialsMatcher() instanceof 
SimpleCredentialsMatcher).isTrue();
         
assertThat(realm.getAuthenticationTokenClass()).isEqualTo(AuthenticationToken.class);
         assertThat(realm.getContextFactory() instanceof 
JndiLdapContextFactory).isTrue();
     }

Reply via email to