From 6a75282ab02f3b249380b69c5e635f425e1c1f5b Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 25 Aug 2015 15:47:47 +0000
Subject: [PATCH] Remove duplicated code
---
opendj-server-legacy/src/main/java/org/opends/server/util/SelectableCertificateKeyManager.java | 32 ++++++--------------------------
1 files changed, 6 insertions(+), 26 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/SelectableCertificateKeyManager.java b/opendj-server-legacy/src/main/java/org/opends/server/util/SelectableCertificateKeyManager.java
index 10f0b64..dff90f2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/SelectableCertificateKeyManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/SelectableCertificateKeyManager.java
@@ -26,8 +26,6 @@
*/
package org.opends.server.util;
-
-
import org.forgerock.i18n.slf4j.LocalizedLogger;
import java.net.Socket;
@@ -41,7 +39,6 @@
import static org.opends.messages.ExtensionMessages.INFO_KEYSTORE_DOES_NOT_CONTAIN_ALIAS;
-
/**
* This class implements an X.509 key manager that will be used to wrap an
* existing key manager and makes it possible to configure which certificate(s)
@@ -57,6 +54,8 @@
public final class SelectableCertificateKeyManager
extends X509ExtendedKeyManager
{
+ private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
+
/** The alias of the certificate that should be selected from the key manager. */
private final String alias;
@@ -66,8 +65,6 @@
/** Provide additional troubleshooting aid to localize a misconfigured SSL connection. */
private final String componentName;
- private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
-
/**
* Creates a new instance of this key manager that will wrap the provided key
@@ -143,7 +140,7 @@
/**
* Chooses the alias of the client certificate that should be used based on
- * the provided critieria. This will either return the preferred alias
+ * the provided criteria. This will either return the preferred alias
* configured for this key manager, or {@code null} if no client certificate
* with that alias is configured in the underlying key manager.
*
@@ -160,30 +157,14 @@
public String chooseEngineClientAlias(String[] keyType, Principal[] issuers,
SSLEngine engine)
{
- for (String type : keyType)
- {
- String[] clientAliases = keyManager.getClientAliases(type, issuers);
- if (clientAliases != null)
- {
- for (String clientAlias : clientAliases)
- {
- if (clientAlias.equals(alias))
- {
- return alias;
- }
- }
- }
- }
-
- logger.warn(INFO_KEYSTORE_DOES_NOT_CONTAIN_ALIAS, componentName, keyType, alias);
- return null;
+ return chooseClientAlias(keyType, issuers, null);
}
/**
* Chooses the alias of the server certificate that should be used based on
- * the provided critieria. This will either return the preferred alias
+ * the provided criteria. This will either return the preferred alias
* configured for this key manager, or {@code null} if no server certificate
* with that alias is configured in the underlying key manager.
*
@@ -218,7 +199,7 @@
/**
* Chooses the alias of the server certificate that should be used based on
- * the provided critieria. This will either return the preferred alias
+ * the provided criteria. This will either return the preferred alias
* configured for this key manager, or {@code null} if no server certificate
* with that alias is configured in the underlying key manager.
* Note that the returned alias can be transformed in lowercase, depending
@@ -362,4 +343,3 @@
return wrap(keyManagers, alias, "[unknown]");
}
}
-
--
Gitblit v1.10.0