From 7efc6f92f5937fb085bb0b72b09214cd79600b8f Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Thu, 03 Apr 2014 15:21:56 +0000
Subject: [PATCH] Checkpoint for OPENDJ-1303 "opendj-cli" - Moved AuthenticatedConnectionFactory from tools to cli.   -- Undo modifications on tools about abstract authenticated connection factory. (and deleted the file)   -- Deleted the file from the tools. - Added functions to opendj-cli Utils. - Trivial code cleanup.

---
 opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/PromptingTrustManager.java |   47 ++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/PromptingTrustManager.java b/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/PromptingTrustManager.java
index 9ab53f4..73694a1 100644
--- a/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/PromptingTrustManager.java
+++ b/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/PromptingTrustManager.java
@@ -54,7 +54,7 @@
  * A trust manager which prompts the user for the length of time that they would
  * like to trust a server certificate.
  */
-final class PromptingTrustManager implements X509TrustManager {
+public final class PromptingTrustManager implements X509TrustManager {
     /**
      * Enumeration description server certificate trust option.
      */
@@ -119,7 +119,27 @@
 
     private final ConsoleApplication app;
 
-    PromptingTrustManager(final ConsoleApplication app, final String acceptedStorePath,
+    /**
+     * Creates a prompting trust manager based on these arguments.
+     *
+     * @param app
+     *            The linked console application.
+     * @param acceptedStorePath
+     *            The store path.
+     * @param sourceTrustManager
+     *            The source of the trust manager.
+     * @throws KeyStoreException
+     *             If no Provider supports a KeyStoreSpi implementation for the specified type.
+     * @throws IOException
+     *             If there is an I/O or format problem with the keystore data, if a password is required but not given,
+     *             or if the given password was incorrect. If the error is due to a wrong password, the cause of the
+     *             IOException should be an UnrecoverableKeyException.
+     * @throws NoSuchAlgorithmException
+     *             If no provider supports a trust manager factory spi implementation for the specified algorithm.
+     * @throws CertificateException
+     *             If any of the certificates in the key store could not be loaded
+     */
+    public PromptingTrustManager(final ConsoleApplication app, final String acceptedStorePath,
             final X509TrustManager sourceTrustManager) throws KeyStoreException, IOException,
             NoSuchAlgorithmException, CertificateException {
         Reject.ifNull(app, acceptedStorePath);
@@ -170,11 +190,30 @@
         this.onDiskTrustManager = x509tm;
     }
 
-    PromptingTrustManager(final ConsoleApplication app, final X509TrustManager sourceTrustManager)
+    /**
+     * Creates a prompting trust manager based on these arguments.
+     *
+     * @param app
+     *            The linked console application.
+     * @param sourceTrustManager
+     *            The source of the trust manager.
+     * @throws KeyStoreException
+     *             If no Provider supports a KeyStoreSpi implementation for the specified type.
+     * @throws IOException
+     *             If there is an I/O or format problem with the keystore data, if a password is required but not given,
+     *             or if the given password was incorrect. If the error is due to a wrong password, the cause of the
+     *             IOException should be an UnrecoverableKeyException.
+     * @throws NoSuchAlgorithmException
+     *             If no provider supports a trust manager factory spi implementation for the specified algorithm.
+     * @throws CertificateException
+     *             If any of the certificates in the key store could not be loaded
+     */
+    public PromptingTrustManager(final ConsoleApplication app, final X509TrustManager sourceTrustManager)
             throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
         this(app, DEFAULT_PATH, sourceTrustManager);
     }
 
+    /** {@inheritDoc} */
     public void checkClientTrusted(final X509Certificate[] x509Certificates, final String s)
             throws CertificateException {
         try {
@@ -196,6 +235,7 @@
         }
     }
 
+    /** {@inheritDoc} */
     public void checkServerTrusted(final X509Certificate[] x509Certificates, final String s)
             throws CertificateException {
         try {
@@ -217,6 +257,7 @@
         }
     }
 
+    /** {@inheritDoc} */
     public X509Certificate[] getAcceptedIssuers() {
         if (nestedTrustManager != null) {
             return nestedTrustManager.getAcceptedIssuers();

--
Gitblit v1.10.0