Spring offers one default implementation of AuthenticationManager which is ProviderManager. ProviderManager has a constructor which takes an array of Authentication providers
public ProviderManager(List<AuthenticationProvider> providers) {
this(providers, null);
}
If you want you can just play with it by extending ProviderManager
public class MyAuthenticationManager extends ProviderManager implements AuthenticationManager{
public MyAuthenticationManager(List<AuthenticationProvider> providers) {
super(providers);
providers.forEach(e->System.out.println("Registered providers "+e.getClass().getName()));
}
}
And then i Java security configuration you can add your custom authentication manager.
@Override
protected AuthenticationManager authenticationManager() throws Exception {
return new MyAuthenticationManager(Arrays.asList(new CustomAuthenticationProvider()));
}