AuthenticationManager is the core interface Spring Security calls to authenticate a request, and ProviderManager is its default implementation, which delegates the actual credential check to one or more AuthenticationProvider instances until one succeeds.
An application configures both a DaoAuthenticationProvider (checking a database) and an LdapAuthenticationProvider; ProviderManager tries each in turn until one successfully authenticates the user.
@Bean
AuthenticationManager authenticationManager(UserDetailsService users,
PasswordEncoder encoder,
LdapAuthenticator ldapAuthenticator) {
DaoAuthenticationProvider database = new DaoAuthenticationProvider();
database.setUserDetailsService(users);
database.setPasswordEncoder(encoder);
LdapAuthenticationProvider ldap = new LdapAuthenticationProvider(ldapAuthenticator);
// ProviderManager asks each provider in turn until one authenticates the user
return new ProviderManager(List.of(database, ldap));
}
// Using it directly, e.g. in a custom login endpoint
Authentication result = authenticationManager.authenticate(
UsernamePasswordAuthenticationToken.unauthenticated(username, password));A concise interview answer is
AuthenticationManager is the interface Spring Security calls to authenticate a request, and ProviderManager is its standard implementation that delegates to a chain of AuthenticationProviders, trying each one until it finds one that can handle and validate the credentials. This lets you plug in multiple authentication sources like database and LDAP side by side.
Last updated: 11 November 2026
Previous question: How can you use Spring Expression Language (SpEL) for fine-grained access control?