Polish ActiveDirectoryLdapAuthenticationProvider#setAuthoritiesPopulator

Issue gh-4490
This commit is contained in:
Josh Cummings 2024-02-09 14:49:28 -07:00
parent 98f0a2120e
commit 4aed6797ef
2 changed files with 6 additions and 3 deletions

View File

@ -143,7 +143,6 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends AbstractLda
this.domain = StringUtils.hasText(domain) ? domain.toLowerCase() : null;
this.url = url;
this.rootDn = StringUtils.hasText(rootDn) ? rootDn.toLowerCase() : null;
this.setAuthoritiesPopulator(this.authoritiesPopulator);
}
/**
@ -155,7 +154,6 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends AbstractLda
this.domain = StringUtils.hasText(domain) ? domain.toLowerCase() : null;
this.url = url;
this.rootDn = (this.domain != null) ? rootDnFromDomain(this.domain) : null;
this.setAuthoritiesPopulator(this.authoritiesPopulator);
}
@Override
@ -179,6 +177,10 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends AbstractLda
}
}
/**
* Creates the user authority list from the values of the {@code memberOf} attribute
* obtained from the user's Active Directory entry.
*/
@Override
protected Collection<? extends GrantedAuthority> loadUserAuthorities(DirContextOperations userData, String username,
String password) {
@ -389,7 +391,7 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends AbstractLda
* @since 6.3
*/
public void setAuthoritiesPopulator(LdapAuthoritiesPopulator authoritiesPopulator) {
Assert.notNull(authoritiesPopulator, "An LdapAuthoritiesPopulator must be supplied");
Assert.notNull(authoritiesPopulator, "authoritiesPopulator must not be null");
this.authoritiesPopulator = authoritiesPopulator;
}

View File

@ -38,6 +38,7 @@ import org.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator;
*
* @author Luke Taylor
* @author Roman Zabaluev
* @since 6.3
*/
public final class DefaultActiveDirectoryAuthoritiesPopulator implements LdapAuthoritiesPopulator {