mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Nicolas Capponi
16.27.2016 9ca3c4828a35ac7e54bc5c00e8a08875a0ba65cd
OPENDJ-3089 OPENDJ-1237 Add missing server matching rules in SchemaHandler initialization
3 files modified
49 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/core/SchemaHandler.java 9 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java 20 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/schema/UserPasswordEqualityMatchingRule.java 20 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/SchemaHandler.java
@@ -46,7 +46,9 @@
import org.opends.server.api.AlertGenerator;
import org.opends.server.replication.plugin.HistoricalCsnOrderingMatchingRuleImpl;
import org.opends.server.schema.AciSyntax;
import org.opends.server.schema.AuthPasswordEqualityMatchingRule;
import org.opends.server.schema.SubtreeSpecificationSyntax;
import org.opends.server.schema.UserPasswordEqualityMatchingRule;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.adapter.server3x.Converters;
@@ -204,10 +206,15 @@
      try
      {
        // Add server specific syntaxes and matching rules not provided by the SDK
        // Add server specific syntaxes not provided by the SDK
        AciSyntax.addAciSyntax(schemaBuilder);
        SubtreeSpecificationSyntax.addSubtreeSpecificationSyntax(schemaBuilder);
        // Add server specific matching rules not provided by the SDK
        HistoricalCsnOrderingMatchingRuleImpl.addHistoricalCsnOrderingMatchingRule(schemaBuilder);
        AuthPasswordEqualityMatchingRule.addAuthPasswordEqualityMatchingRule(schemaBuilder);
        UserPasswordEqualityMatchingRule.addUserPasswordEqualityMatchingRule(schemaBuilder);
      }
      catch (ConflictingSchemaElementException e)
      {
opendj-server-legacy/src/main/java/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java
@@ -16,15 +16,18 @@
 */
package org.opends.server.schema;
import static org.opends.server.schema.SchemaConstants.*;
import static org.opends.server.core.DirectoryServer.*;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.schema.SchemaBuilder;
import org.opends.server.api.PasswordStorageScheme;
/** This class implements the authPasswordMatch matching rule defined in RFC 3112. */
class AuthPasswordEqualityMatchingRule extends AbstractPasswordEqualityMatchingRuleImpl
public class AuthPasswordEqualityMatchingRule extends AbstractPasswordEqualityMatchingRuleImpl
{
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -55,4 +58,19 @@
    return ConditionResult.valueOf(storageScheme.authPasswordMatches(
        assertionValue, authPWComponents[1], authPWComponents[2]));
  }
  /**
   * Adds the auth password equality matching rule to the provided schema builder.
   *
   * @param builder
   *          where to add the matching rule
   */
  public static void addAuthPasswordEqualityMatchingRule(SchemaBuilder builder)
  {
    builder.buildMatchingRule(EMR_AUTH_PASSWORD_OID)
        .names(EMR_AUTH_PASSWORD_NAME)
        .syntaxOID(SYNTAX_AUTH_PASSWORD_OID).description(EMR_AUTH_PASSWORD_DESCRIPTION)
        .implementation(new AuthPasswordEqualityMatchingRule())
        .addToSchema();
  }
}
opendj-server-legacy/src/main/java/org/opends/server/schema/UserPasswordEqualityMatchingRule.java
@@ -16,10 +16,13 @@
 */
package org.opends.server.schema;
import static org.opends.server.schema.SchemaConstants.*;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.schema.SchemaBuilder;
import org.opends.server.api.PasswordStorageScheme;
import static org.opends.server.core.DirectoryServer.*;
@@ -31,7 +34,7 @@
 * This matching rule serves a similar purpose to the equivalent
 * AuthPasswordEqualityMatchingRule defined in RFC 3112 (http://tools.ietf.org/html/rfc3112).
 */
class UserPasswordEqualityMatchingRule extends AbstractPasswordEqualityMatchingRuleImpl
public class UserPasswordEqualityMatchingRule extends AbstractPasswordEqualityMatchingRuleImpl
{
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -66,4 +69,19 @@
        storageScheme.passwordMatches(assertionValue, ByteString.valueOfUtf8(userPWComponents[1])));
  }
  /**
   * Adds the user password equality matching rule to the provided schema builder.
   *
   * @param builder
   *          where to add the matching rule
   */
  public static void addUserPasswordEqualityMatchingRule(SchemaBuilder builder)
  {
    builder.buildMatchingRule(EMR_USER_PASSWORD_OID)
      .names(EMR_USER_PASSWORD_NAME)
      .syntaxOID(SYNTAX_OCTET_STRING_OID).description(EMR_USER_PASSWORD_DESCRIPTION)
      .implementation(new UserPasswordEqualityMatchingRule())
      .addToSchema();
  }
}