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

Jean-Noël Rouvignac
20.42.2016 61b9eb1be03fc03a9f4bb0013a08ff44a1059503
opendj-server-legacy/src/main/java/org/opends/server/extensions/PlainSASLMechanismHandler.java
@@ -64,14 +64,12 @@
{
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
  /** The identity mapper that will be used to map ID strings to user entries.*/
  /** The identity mapper that will be used to map ID strings to user entries. */
  private IdentityMapper<?> identityMapper;
  /** The current configuration for this SASL mechanism handler. */
  private PlainSASLMechanismHandlerCfg currentConfig;
  /**
   * Creates a new instance of this SASL mechanism handler.  No initialization
   * should be done in this method, as it should all be performed in the
@@ -82,9 +80,6 @@
    super();
  }
  /** {@inheritDoc} */
  @Override
  public void initializeSASLMechanismHandler(
                   PlainSASLMechanismHandlerCfg configuration)
@@ -93,18 +88,13 @@
    configuration.addPlainChangeListener(this);
    currentConfig = configuration;
    // Get the identity mapper that should be used to find users.
    DN identityMapperDN = configuration.getIdentityMapperDN();
    identityMapper = DirectoryServer.getIdentityMapper(identityMapperDN);
    DirectoryServer.registerSASLMechanismHandler(SASL_MECHANISM_PLAIN, this);
  }
  /** {@inheritDoc} */
  @Override
  public void finalizeSASLMechanismHandler()
  {
@@ -112,10 +102,6 @@
    DirectoryServer.deregisterSASLMechanismHandler(SASL_MECHANISM_PLAIN);
  }
  /** {@inheritDoc} */
  @Override
  public void processSASLBind(BindOperation bindOperation)
  {
@@ -151,7 +137,6 @@
      authzID = credString.substring(0, nullPos1);
    }
    int nullPos2 = credString.indexOf('\u0000', nullPos1+1);
    if (nullPos2 < 0)
    {
@@ -183,7 +168,6 @@
    authcID  = credString.substring(nullPos1+1, nullPos2);
    password = credString.substring(nullPos2+1);
    // Get the user entry for the authentication ID.  Allow for an
    // authentication ID that is just a username (as per the SASL PLAIN spec),
    // but also allow a value in the authzid form specified in RFC 2829.
@@ -259,7 +243,6 @@
      }
    }
    // At this point, we should have a user entry.  If we don't then fail.
    if (userEntry == null)
    {
@@ -274,7 +257,6 @@
      bindOperation.setSASLAuthUserEntry(userEntry);
    }
    // If an authorization ID was provided, then make sure that it is
    // acceptable.
    Entry authZEntry = userEntry;
@@ -413,7 +395,6 @@
      }
    }
    // Get the password policy for the user and use it to determine if the
    // provided password was correct.
    try
@@ -452,7 +433,6 @@
      return;
    }
    // If we've gotten here, then the authentication was successful.
    bindOperation.setResultCode(ResultCode.SUCCESS);
@@ -464,9 +444,6 @@
    return;
  }
  /** {@inheritDoc} */
  @Override
  public boolean isPasswordBased(String mechanism)
  {
@@ -474,9 +451,6 @@
    return true;
  }
  /** {@inheritDoc} */
  @Override
  public boolean isSecure(String mechanism)
  {
@@ -484,9 +458,6 @@
    return false;
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationAcceptable(
                      SASLMechanismHandlerCfg configuration,
@@ -497,9 +468,6 @@
    return isConfigurationChangeAcceptable(config, unacceptableReasons);
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationChangeAcceptable(
                      PlainSASLMechanismHandlerCfg configuration,
@@ -508,9 +476,6 @@
    return true;
  }
  /** {@inheritDoc} */
  @Override
  public ConfigChangeResult applyConfigurationChange(
              PlainSASLMechanismHandlerCfg configuration)