diff --git a/core/src/main/java/org/springframework/security/providers/ldap/LdapAuthenticationProvider.java b/core/src/main/java/org/springframework/security/providers/ldap/LdapAuthenticationProvider.java index 580b7e2a4a..eb922cb133 100644 --- a/core/src/main/java/org/springframework/security/providers/ldap/LdapAuthenticationProvider.java +++ b/core/src/main/java/org/springframework/security/providers/ldap/LdapAuthenticationProvider.java @@ -225,7 +225,7 @@ public class LdapAuthenticationProvider implements AuthenticationProvider { try { DirContextOperations userData = getAuthenticator().authenticate(authentication); - GrantedAuthority[] extraAuthorities = getAuthoritiesPopulator().getGrantedAuthorities(userData, username); + GrantedAuthority[] extraAuthorities = loadUserAuthorities(userData, username, password); UserDetails user = userDetailsContextMapper.mapUserFromContext(userData, username, extraAuthorities); @@ -236,6 +236,10 @@ public class LdapAuthenticationProvider implements AuthenticationProvider { } } + protected GrantedAuthority[] loadUserAuthorities(DirContextOperations userData, String username, String password) { + return getAuthoritiesPopulator().getGrantedAuthorities(userData, username); + } + protected Authentication createSuccessfulAuthentication(UsernamePasswordAuthenticationToken authentication, UserDetails user) { Object password = useAuthenticationRequestCredentials ? authentication.getCredentials() : user.getPassword();