default:
Message message =
ERR_PLUGIN_PWPIMPORT_INVALID_PLUGIN_TYPE.get(t.toString());
throw new ConfigException(message);
}
}
// Get the set of default password storage schemes for auth password
// attributes.
PasswordPolicy defaultPolicy = DirectoryServer.getDefaultPasswordPolicy();
Set<DN> authSchemeDNs =
configuration.getDefaultAuthPasswordStorageSchemeDNs();
if (authSchemeDNs.isEmpty())
{
if (defaultPolicy.usesAuthPasswordSyntax())
{
CopyOnWriteArrayList<PasswordStorageScheme<?>> schemeList =
defaultPolicy.getDefaultStorageSchemes();
defaultAuthPasswordSchemes =
new PasswordStorageScheme[schemeList.size()];
schemeList.toArray(defaultAuthPasswordSchemes);
}
else
{
defaultAuthPasswordSchemes = new PasswordStorageScheme[1];
defaultAuthPasswordSchemes[0] =
DirectoryServer.getAuthPasswordStorageScheme(
AUTH_PASSWORD_SCHEME_NAME_SALTED_SHA_1);
if (defaultAuthPasswordSchemes[0] == null)
{
Message message = ERR_PLUGIN_PWIMPORT_NO_DEFAULT_AUTH_SCHEMES.get(
AUTH_PASSWORD_SCHEME_NAME_SALTED_SHA_1);
throw new ConfigException(message);
}
}
}
else
{
defaultAuthPasswordSchemes =
new PasswordStorageScheme[authSchemeDNs.size()];
int i=0;
for (DN schemeDN : authSchemeDNs)
{
defaultAuthPasswordSchemes[i] =
DirectoryServer.getPasswordStorageScheme(schemeDN);
if (defaultAuthPasswordSchemes[i] == null)
{
Message message =
ERR_PLUGIN_PWIMPORT_NO_SUCH_DEFAULT_AUTH_SCHEME.get(
String.valueOf(schemeDN));
throw new ConfigException(message);
}
else if (! defaultAuthPasswordSchemes[i].supportsAuthPasswordSyntax())
{
Message message =
ERR_PLUGIN_PWIMPORT_INVALID_DEFAULT_AUTH_SCHEME.get(
String.valueOf(schemeDN));
throw new ConfigException(message);
}
i++;
}
}
// Get the set of default password storage schemes for user password
// attributes.
Set<DN> userSchemeDNs =
configuration.getDefaultUserPasswordStorageSchemeDNs();
if (userSchemeDNs.isEmpty())
{
if (! defaultPolicy.usesAuthPasswordSyntax())
{
CopyOnWriteArrayList<PasswordStorageScheme<?>> schemeList =
defaultPolicy.getDefaultStorageSchemes();
defaultUserPasswordSchemes =
new PasswordStorageScheme[schemeList.size()];
schemeList.toArray(defaultUserPasswordSchemes);
}
else
{
defaultUserPasswordSchemes = new PasswordStorageScheme[1];
defaultUserPasswordSchemes[0] =
DirectoryServer.getPasswordStorageScheme(
toLowerCase(STORAGE_SCHEME_NAME_SALTED_SHA_1));
if (defaultUserPasswordSchemes[0] == null)
{
Message message = ERR_PLUGIN_PWIMPORT_NO_DEFAULT_USER_SCHEMES.get(
STORAGE_SCHEME_NAME_SALTED_SHA_1);
throw new ConfigException(message);
}
}
}
else
{
defaultUserPasswordSchemes =
new PasswordStorageScheme[userSchemeDNs.size()];
int i=0;
for (DN schemeDN : userSchemeDNs)
{
defaultUserPasswordSchemes[i] =
DirectoryServer.getPasswordStorageScheme(schemeDN);
if (defaultUserPasswordSchemes[i] == null)
{
Message message =
ERR_PLUGIN_PWIMPORT_INVALID_DEFAULT_USER_SCHEME.get(
String.valueOf(schemeDN));
throw new ConfigException(message);
}
i++;
}
}