if (manager != null)
{
AuthenticationProviderAdapter<?> authenticationProvider;
if (manager instanceof PrincipalDatabaseAuthenticationManager)
{
authenticationProvider = new PrincipalDatabaseAuthenticationManagerAdapter(id, broker,
(PrincipalDatabaseAuthenticationManager) manager, attributes, factory.getAttributeNames());
}
else
{
authenticationProvider = new SimpleAuthenticationProviderAdapter(id, broker, manager, attributes, factory.getAttributeNames());