| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.plugins; |
| | | |
| | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.meta.PluginCfgDefn; |
| | | import org.opends.server.admin.std.server.PasswordPolicyImportPluginCfg; |
| | | import org.opends.server.admin.std.server.PluginCfg; |
| | | import org.opends.server.api.AuthenticationPolicy; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.ImportTaskListener; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.PasswordPolicy; |
| | | import org.opends.server.core.PasswordPolicyConfigManager; |
| | | import org.opends.server.core.SubentryPasswordPolicy; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.schema.AuthPasswordSyntax; |
| | | import org.opends.server.schema.UserPasswordSyntax; |
| | |
| | | configuration.getDefaultAuthPasswordStorageSchemeDNs(); |
| | | if (authSchemeDNs.isEmpty()) |
| | | { |
| | | if (defaultPolicy.usesAuthPasswordSyntax()) |
| | | if (defaultPolicy.isAuthPasswordSyntax()) |
| | | { |
| | | CopyOnWriteArrayList<PasswordStorageScheme<?>> schemeList = |
| | | defaultPolicy.getDefaultStorageSchemes(); |
| | | List<PasswordStorageScheme<?>> schemeList = |
| | | defaultPolicy.getDefaultPasswordStorageSchemes(); |
| | | defaultAuthPasswordSchemes = |
| | | new PasswordStorageScheme[schemeList.size()]; |
| | | schemeList.toArray(defaultAuthPasswordSchemes); |
| | |
| | | configuration.getDefaultUserPasswordStorageSchemeDNs(); |
| | | if (userSchemeDNs.isEmpty()) |
| | | { |
| | | if (! defaultPolicy.usesAuthPasswordSyntax()) |
| | | if (! defaultPolicy.isAuthPasswordSyntax()) |
| | | { |
| | | CopyOnWriteArrayList<PasswordStorageScheme<?>> schemeList = |
| | | defaultPolicy.getDefaultStorageSchemes(); |
| | | List<PasswordStorageScheme<?>> schemeList = |
| | | defaultPolicy.getDefaultPasswordStorageSchemes(); |
| | | defaultUserPasswordSchemes = |
| | | new PasswordStorageScheme[schemeList.size()]; |
| | | schemeList.toArray(defaultUserPasswordSchemes); |
| | |
| | | // attribute types associated with them. |
| | | HashMap<DN,PasswordStorageScheme<?>[]> schemeMap = |
| | | new HashMap<DN,PasswordStorageScheme<?>[]>(); |
| | | for (PasswordPolicy p : DirectoryServer.getPasswordPolicies()) |
| | | for (AuthenticationPolicy ap : DirectoryServer.getAuthenticationPolicies()) |
| | | { |
| | | CopyOnWriteArrayList<PasswordStorageScheme<?>> schemeList = |
| | | p.getDefaultStorageSchemes(); |
| | | PasswordPolicy p = (PasswordPolicy) ap; |
| | | |
| | | List<PasswordStorageScheme<?>> schemeList = |
| | | p.getDefaultPasswordStorageSchemes(); |
| | | PasswordStorageScheme<?>[] schemeArray = |
| | | new PasswordStorageScheme[schemeList.size()]; |
| | | schemeList.toArray(schemeArray); |
| | | schemeMap.put(p.getConfigEntryDN(), schemeArray); |
| | | schemeMap.put(p.getDN(), schemeArray); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | PasswordPolicyConfigManager.checkSubentryAcceptable(entry); |
| | | new SubentryPasswordPolicy(new SubEntry(entry)); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | try |
| | | { |
| | | policyDN = DN.decode(v.getValue()); |
| | | policy = DirectoryServer.getPasswordPolicy(policyDN); |
| | | policy = (PasswordPolicy) DirectoryServer |
| | | .getAuthenticationPolicy(policyDN); |
| | | if (policy == null) |
| | | { |
| | | Message message = WARN_PLUGIN_PWIMPORT_NO_SUCH_POLICY.get( |
| | |
| | | { |
| | | ByteString value = v.getValue(); |
| | | |
| | | if (policy.usesAuthPasswordSyntax()) |
| | | if (policy.isAuthPasswordSyntax()) |
| | | { |
| | | if (!AuthPasswordSyntax.isEncoded(value)) |
| | | { |
| | |
| | | configuration.getDefaultAuthPasswordStorageSchemeDNs(); |
| | | if (authSchemeDNs.isEmpty()) |
| | | { |
| | | if (defaultPolicy.usesAuthPasswordSyntax()) |
| | | if (defaultPolicy.isAuthPasswordSyntax()) |
| | | { |
| | | CopyOnWriteArrayList<PasswordStorageScheme<?>> schemeList = |
| | | defaultPolicy.getDefaultStorageSchemes(); |
| | | List<PasswordStorageScheme<?>> schemeList = |
| | | defaultPolicy.getDefaultPasswordStorageSchemes(); |
| | | defaultAuthSchemes = |
| | | new PasswordStorageScheme[schemeList.size()]; |
| | | schemeList.toArray(defaultAuthSchemes); |
| | |
| | | configuration.getDefaultUserPasswordStorageSchemeDNs(); |
| | | if (userSchemeDNs.isEmpty()) |
| | | { |
| | | if (! defaultPolicy.usesAuthPasswordSyntax()) |
| | | if (! defaultPolicy.isAuthPasswordSyntax()) |
| | | { |
| | | CopyOnWriteArrayList<PasswordStorageScheme<?>> schemeList = |
| | | defaultPolicy.getDefaultStorageSchemes(); |
| | | List<PasswordStorageScheme<?>> schemeList = |
| | | defaultPolicy.getDefaultPasswordStorageSchemes(); |
| | | defaultUserSchemes = |
| | | new PasswordStorageScheme[schemeList.size()]; |
| | | schemeList.toArray(defaultUserSchemes); |