String newName = (String)attributes.get(NAME);
String currentName = getName();
if (!currentName.equals(newName))
{
throw new IllegalConfigurationException("Changing the name of authentication provider is not supported");
}
String newType = (String)attributes.get(AuthenticationManagerFactory.ATTRIBUTE_TYPE);
String currentType = (String)getAttribute(AuthenticationManagerFactory.ATTRIBUTE_TYPE);
if (!currentType.equals(newType))
{
throw new IllegalConfigurationException("Changing the type of authentication provider is not supported");
}
AuthenticationManagerFactory managerFactory = _factories.get(newType);
if (managerFactory == null)
{
throw new IllegalConfigurationException("Cannot find authentication provider factory for type " + newType);
}
AuthenticationManager manager = managerFactory.createInstance(attributes);
if (manager == null)
{
throw new IllegalConfigurationException("Cannot change authentication provider " + newName + " of type " + newType + " with the given attributes");
}
return manager;
}