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

Jean-Noël Rouvignac
20.36.2016 2a3158aad80fc910b83336485b3e545dea50066c
opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ApplicationTrustManager.java
@@ -13,9 +13,8 @@
 *
 * Copyright 2008-2009 Sun Microsystems, Inc.
 * Portions Copyright 2009 Parametric Technology Corporation (PTC)
 * Portions Copyright 2011-2015 ForgeRock AS.
 * Portions Copyright 2011-2016 ForgeRock AS.
 */
package org.opends.admin.ads.util;
import java.security.KeyStore;
@@ -46,8 +45,7 @@
 * it cannot be retrieved this class will only accept the certificates
 * explicitly accepted by the user (and specified by calling acceptCertificate).
 *
 * NOTE: this class is not aimed to be used when we have connections in
 * parallel.
 * NOTE: this class is not aimed to be used when we have connections in parallel.
 */
public class ApplicationTrustManager implements X509TrustManager
{
@@ -57,14 +55,9 @@
   */
  public enum Cause
  {
    /**
     * The certificate was not trusted.
     */
    /** The certificate was not trusted. */
    NOT_TRUSTED,
    /**
     * The certificate's subject DN's value and the host name we tried to
     * connect to do not match.
     */
    /** The certificate's subject DN's value and the host name we tried to connect to do not match. */
    HOST_NAME_MISMATCH
  }
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -85,7 +78,6 @@
  private String host;
  /**
   * The default constructor.
   *
@@ -161,7 +153,7 @@
      }
  }
  /** {@inheritDoc} */
  @Override
  public void checkClientTrusted(X509Certificate[] chain, String authType)
  throws CertificateException
  {
@@ -195,7 +187,7 @@
    {
      try
      {
        verifyHostName(chain, authType);
        verifyHostName(chain);
      }
      catch (CertificateException ce)
      {
@@ -204,7 +196,7 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public void checkServerTrusted(X509Certificate[] chain,
      String authType) throws CertificateException
  {
@@ -238,7 +230,7 @@
    {
      try
      {
        verifyHostName(chain, authType);
        verifyHostName(chain);
      }
      catch (CertificateException ce)
      {
@@ -257,7 +249,7 @@
    throw new OpendsCertificateException(chain, ce);
  }
  /** {@inheritDoc} */
  @Override
  public X509Certificate[] getAcceptedIssuers()
  {
    if (trustManager != null)
@@ -364,8 +356,7 @@
   * @throws CertificateException if the subject DN of the certificate does
   * not match with the host name specified with the method setHost.
   */
  private void verifyHostName(X509Certificate[] chain, String authType)
  throws CertificateException
  private void verifyHostName(X509Certificate[] chain) throws CertificateException
  {
    if (host != null)
    {