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/FingerprintCertificateMapper.java
@@ -77,7 +77,6 @@
  /** The set of attributes to return in search result entries. */
  private LinkedHashSet<String> requestedAttributes;
  /**
   * Creates a new instance of this certificate mapper.  Note that all actual
   * initialization should be done in the
@@ -88,9 +87,6 @@
    super();
  }
  /** {@inheritDoc} */
  @Override
  public void initializeCertificateMapper(
                   FingerprintCertificateMapperCfg configuration)
@@ -111,7 +107,6 @@
        break;
    }
    // Make sure that the fingerprint attribute is configured for equality in
    // all appropriate backends.
    Set<DN> cfgBaseDNs = configuration.getUserBaseDN();
@@ -136,18 +131,12 @@
    requestedAttributes = newLinkedHashSet("*", "+");
  }
  /** {@inheritDoc} */
  @Override
  public void finalizeCertificateMapper()
  {
    currentConfig.removeFingerprintChangeListener(this);
  }
  /** {@inheritDoc} */
  @Override
  public Entry mapCertificateToUser(Certificate[] certificateChain)
         throws DirectoryException
@@ -163,7 +152,6 @@
      throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message);
    }
    // Get the first certificate in the chain.  It must be an X.509 certificate.
    X509Certificate peerCertificate;
    try
@@ -179,7 +167,6 @@
      throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message);
    }
    // Get the signature from the peer certificate and create a digest of it
    // using the configured algorithm.
    String fingerprintString;
@@ -201,13 +188,11 @@
      throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message);
    }
    // Create the search filter from the fingerprint.
    ByteString value = ByteString.valueOfUtf8(fingerprintString);
    SearchFilter filter =
         SearchFilter.createEqualityFilter(fingerprintAttributeType, value);
    // If we have an explicit set of base DNs, then use it.  Otherwise, use the
    // set of public naming contexts in the server.
    Collection<DN> baseDNs = config.getUserBaseDN();
@@ -216,7 +201,6 @@
      baseDNs = DirectoryServer.getPublicNamingContexts().keySet();
    }
    // For each base DN, issue an internal search in an attempt to map the
    // certificate.
    Entry userEntry = null;
@@ -247,7 +231,6 @@
          throw new DirectoryException(
                  ResultCode.INVALID_CREDENTIALS, message);
        case TIME_LIMIT_EXCEEDED:
        case ADMIN_LIMIT_EXCEEDED:
          // The search criteria was too inefficient.
@@ -277,15 +260,11 @@
      }
    }
    // If we've gotten here, then we either found exactly one user entry or we
    // didn't find any.  Either way, return the entry or null to the caller.
    return userEntry;
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationAcceptable(CertificateMapperCfg configuration,
                                           List<LocalizableMessage> unacceptableReasons)
@@ -295,9 +274,6 @@
    return isConfigurationChangeAcceptable(config, unacceptableReasons);
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationChangeAcceptable(
                      FingerprintCertificateMapperCfg configuration,
@@ -306,16 +282,12 @@
    return true;
  }
  /** {@inheritDoc} */
  @Override
  public ConfigChangeResult applyConfigurationChange(
              FingerprintCertificateMapperCfg configuration)
  {
    final ConfigChangeResult ccr = new ConfigChangeResult();
    // Get the algorithm that will be used to generate the fingerprint.
    String newFingerprintAlgorithm = null;
    switch (configuration.getFingerprintAlgorithm())
@@ -328,7 +300,6 @@
        break;
    }
    if (ccr.getResultCode() == ResultCode.SUCCESS)
    {
      fingerprintAlgorithm = newFingerprintAlgorithm;