From fd2092b89bfd222d23d01576baf4a283e7e1c62a Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 06 Sep 2007 01:14:54 +0000
Subject: [PATCH] Update password storage scheme references in the server so that they use DNs rather than storage scheme names. This will allow better consistency in the configuration, since all other references between configuration objects are DN-based, and it will work better with the upcoming aggregation support. It also eliminates the need to know the storage scheme name, which is not obvious from looking at the configuration entry for the storage scheme, and can actually vary in some implementations depending on whether it's used with a user password or auth password syntax attribute.
---
opends/src/server/org/opends/server/core/DirectoryServer.java | 55 +++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 45 insertions(+), 10 deletions(-)
diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index 0b93dd2..a0267d7 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -457,6 +457,11 @@
private ConcurrentHashMap<String,PasswordStorageScheme>
passwordStorageSchemes;
+ // The set of password storage schemes defined in the server (mapped between
+ // the DN of the configuration entry and the storage scheme).
+ private ConcurrentHashMap<DN,PasswordStorageScheme>
+ passwordStorageSchemesByDN;
+
// The set of SASL mechanism handlers registered with the server (mapped
// between the mechanism name and the handler).
private ConcurrentHashMap<String,SASLMechanismHandler> saslMechanismHandlers;
@@ -863,6 +868,8 @@
directoryServer.alertHandlers = new CopyOnWriteArrayList<AlertHandler>();
directoryServer.passwordStorageSchemes =
new ConcurrentHashMap<String,PasswordStorageScheme>();
+ directoryServer.passwordStorageSchemesByDN =
+ new ConcurrentHashMap<DN,PasswordStorageScheme>();
directoryServer.passwordGenerators =
new ConcurrentHashMap<DN,PasswordGenerator>();
directoryServer.authPasswordStorageSchemes =
@@ -4812,6 +4819,23 @@
/**
+ * Retrieves the password storage scheme defined in the specified
+ * configuration entry.
+ *
+ * @param configEntryDN The DN of the configuration entry that defines the
+ * password storage scheme to retrieve.
+ *
+ * @return The requested password storage scheme, or {@code null} if no such
+ * scheme is defined.
+ */
+ public static PasswordStorageScheme getPasswordStorageScheme(DN configEntryDN)
+ {
+ return directoryServer.passwordStorageSchemesByDN.get(configEntryDN);
+ }
+
+
+
+ /**
* Retrieves the set of password storage schemes defined in the Directory
* Server, as a mapping between the all-lowercase scheme name and the
* corresponding implementation.
@@ -4880,11 +4904,16 @@
* If an existing password storage scheme is registered with the same name,
* then it will be replaced with the provided scheme.
*
- * @param scheme The password storage scheme to register with the Directory
- * Server.
+ * @param configEntryDN The DN of the configuration entry that defines the
+ * password storage scheme.
+ * @param scheme The password storage scheme to register with the
+ * Directory Server.
*/
- public static void registerPasswordStorageScheme(PasswordStorageScheme scheme)
+ public static void registerPasswordStorageScheme(DN configEntryDN,
+ PasswordStorageScheme scheme)
{
+ directoryServer.passwordStorageSchemesByDN.put(configEntryDN, scheme);
+
String name = toLowerCase(scheme.getStorageSchemeName());
directoryServer.passwordStorageSchemes.put(name, scheme);
@@ -4902,18 +4931,24 @@
* Server. If no scheme is registered with the specified name, then no action
* will be taken.
*
- * @param lowerName The name of the password storage scheme to deregister,
- * formatted in all lowercache characters.
+ * @param configEntryDN The DN of the configuration entry that defines the
+ * password storage scheme.
*/
- public static void deregisterPasswordStorageScheme(String lowerName)
+ public static void deregisterPasswordStorageScheme(DN configEntryDN)
{
PasswordStorageScheme scheme =
- directoryServer.passwordStorageSchemes.remove(lowerName);
+ directoryServer.passwordStorageSchemesByDN.remove(configEntryDN);
- if ((scheme != null) && scheme.supportsAuthPasswordSyntax())
+ if (scheme != null)
{
- directoryServer.authPasswordStorageSchemes.remove(
- scheme.getAuthPasswordSchemeName());
+ directoryServer.passwordStorageSchemes.remove(
+ toLowerCase(scheme.getStorageSchemeName()));
+
+ if (scheme.supportsAuthPasswordSyntax())
+ {
+ directoryServer.authPasswordStorageSchemes.remove(
+ scheme.getAuthPasswordSchemeName());
+ }
}
}
--
Gitblit v1.10.0