Skip to content

Commit

Permalink
rename, change LoggerFactory to LogManager
Browse files Browse the repository at this point in the history
Signed-off-by: Maciej Mierzwa <[email protected]>
  • Loading branch information
MaciejMierzwa committed Jan 11, 2024
1 parent 67bd6c3 commit 31cb3e0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import net.shibboleth.utilities.java.support.resolver.ResolverException;
import org.opensaml.saml.metadata.resolver.impl.AbstractReloadingMetadataResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class HTTPMetadataResolver extends AbstractReloadingMetadataResolver {
private final Logger log = LoggerFactory.getLogger(HTTPMetadataResolver.class);
private final static Logger log = LogManager.getLogger(HTTPMetadataResolver.class);
private HttpClient httpClient;
private URI metadataURI;
private String cachedMetadataETag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.opensearch.SpecialPermission;
import org.opensearch.common.settings.Settings;

import com.amazon.dlic.util.SettingsBasedSSLConfiguratorV5;
import com.amazon.dlic.util.SettingsBasedSSLConfiguratorV4;
import net.shibboleth.utilities.java.support.resolver.ResolverException;

public class SamlHTTPMetadataResolver extends HTTPMetadataResolver {
Expand All @@ -56,8 +56,8 @@ protected byte[] fetchMetadata() throws ResolverException {
}
}

private static SettingsBasedSSLConfiguratorV5.SSLConfig getSSLConfig(Settings settings, Path configPath) throws Exception {
return new SettingsBasedSSLConfiguratorV5(settings, configPath, "idp").buildSSLConfig();
private static SettingsBasedSSLConfiguratorV4.SSLConfig getSSLConfig(Settings settings, Path configPath) throws Exception {
return new SettingsBasedSSLConfiguratorV4(settings, configPath, "idp").buildSSLConfig();
}

private static HttpClient createHttpClient(Settings settings, Path configPath) throws Exception {
Expand Down Expand Up @@ -89,7 +89,7 @@ private static HttpClient createHttpClient0(Settings settings, Path configPath)

builder.useSystemProperties();

SettingsBasedSSLConfiguratorV5.SSLConfig sslConfig = getSSLConfig(settings, configPath);
SettingsBasedSSLConfiguratorV4.SSLConfig sslConfig = getSSLConfig(settings, configPath);

if (sslConfig != null) {
SSLConnectionSocketFactory sslConnectionSocketFactory = sslConfig.toSSLConnectionSocketFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import static org.opensearch.security.ssl.SecureSSLSettings.SSLSetting.SECURITY_SSL_TRANSPORT_KEYSTORE_PASSWORD;
import static org.opensearch.security.ssl.SecureSSLSettings.SSLSetting.SECURITY_SSL_TRANSPORT_TRUSTSTORE_PASSWORD;

public class SettingsBasedSSLConfiguratorV5 {
public class SettingsBasedSSLConfiguratorV4 {
private static final Logger log = LogManager.getLogger(SettingsBasedSSLConfigurator.class);

public static final String CERT_ALIAS = "cert_alias";
Expand Down Expand Up @@ -90,14 +90,14 @@ public class SettingsBasedSSLConfiguratorV5 {
private String effectiveKeyAlias;
private List<String> effectiveTruststoreAliases;

public SettingsBasedSSLConfiguratorV5(Settings settings, Path configPath, String settingsKeyPrefix, String clientName) {
public SettingsBasedSSLConfiguratorV4(Settings settings, Path configPath, String settingsKeyPrefix, String clientName) {
this.settings = settings;
this.configPath = configPath;
this.settingsKeyPrefix = normalizeSettingsKeyPrefix(settingsKeyPrefix);
this.clientName = clientName != null ? clientName : this.settingsKeyPrefix;
}

public SettingsBasedSSLConfiguratorV5(Settings settings, Path configPath, String settingsKeyPrefix) {
public SettingsBasedSSLConfiguratorV4(Settings settings, Path configPath, String settingsKeyPrefix) {
this(settings, configPath, settingsKeyPrefix, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@
import org.opensearch.security.test.helper.file.FileHelper;
import org.opensearch.security.test.helper.network.SocketUtils;

import com.amazon.dlic.util.SettingsBasedSSLConfiguratorV5;
import com.amazon.dlic.util.SettingsBasedSSLConfiguratorV5.SSLConfig;
import com.amazon.dlic.util.SettingsBasedSSLConfiguratorV4;
import com.amazon.dlic.util.SettingsBasedSSLConfiguratorV4.SSLConfig;

import static org.hamcrest.CoreMatchers.either;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.opensearch.security.ssl.SecureSSLSettings.SSLSetting.SECURITY_SSL_TRANSPORT_TRUSTSTORE_PASSWORD;

public class SettingsBasedSSLConfiguratorV5Test {
public class SettingsBasedSSLConfiguratorV4Test {

@Rule
public ExpectedException thrown = ExpectedException.none();
Expand All @@ -106,7 +106,7 @@ public void testPemTrust() throws Exception {
.build();
Path configPath = rootCaPemPath.getParent();

SettingsBasedSSLConfiguratorV5 sbsc = new SettingsBasedSSLConfiguratorV5(settings, configPath, "prefix");
SettingsBasedSSLConfiguratorV4 sbsc = new SettingsBasedSSLConfiguratorV4(settings, configPath, "prefix");

SSLConfig sslConfig = sbsc.buildSSLConfig();
SSLConnectionSocketFactory sslConnectionSocketFactory = sslConfig.toSSLConnectionSocketFactory();
Expand Down Expand Up @@ -145,7 +145,7 @@ public void testPemWrongTrust() throws Exception {
.build();
Path configPath = rootCaPemPath.getParent();

SettingsBasedSSLConfiguratorV5 sbsc = new SettingsBasedSSLConfiguratorV5(settings, configPath, "prefix");
SettingsBasedSSLConfiguratorV4 sbsc = new SettingsBasedSSLConfiguratorV4(settings, configPath, "prefix");

SSLConfig sslConfig = sbsc.buildSSLConfig();
SSLConnectionSocketFactory sslConnectionSocketFactory = sslConfig.toSSLConnectionSocketFactory();
Expand Down Expand Up @@ -190,7 +190,7 @@ public void testPemClientAuth() throws Exception {
.build();
Path configPath = rootCaPemPath.getParent();

SettingsBasedSSLConfiguratorV5 sbsc = new SettingsBasedSSLConfiguratorV5(settings, configPath, "prefix");
SettingsBasedSSLConfiguratorV4 sbsc = new SettingsBasedSSLConfiguratorV4(settings, configPath, "prefix");

SSLConfig sslConfig = sbsc.buildSSLConfig();
SSLConnectionSocketFactory sslConnectionSocketFactory = sslConfig.toSSLConnectionSocketFactory();
Expand Down Expand Up @@ -233,7 +233,7 @@ public void testPemClientAuthFailure() throws Exception {
.build();
Path configPath = rootCaPemPath.getParent();

SettingsBasedSSLConfiguratorV5 sbsc = new SettingsBasedSSLConfiguratorV5(settings, configPath, "prefix");
SettingsBasedSSLConfiguratorV4 sbsc = new SettingsBasedSSLConfiguratorV4(settings, configPath, "prefix");

SSLConfig sslConfig = sbsc.buildSSLConfig();
SSLConnectionSocketFactory sslConnectionSocketFactory = sslConfig.toSSLConnectionSocketFactory();
Expand Down Expand Up @@ -281,7 +281,7 @@ public void testPemHostnameVerificationFailure() throws Exception {
.build();
Path configPath = rootCaPemPath.getParent();

SettingsBasedSSLConfiguratorV5 sbsc = new SettingsBasedSSLConfiguratorV5(settings, configPath, "prefix");
SettingsBasedSSLConfiguratorV4 sbsc = new SettingsBasedSSLConfiguratorV4(settings, configPath, "prefix");

SSLConfig sslConfig = sbsc.buildSSLConfig();
SSLConnectionSocketFactory sslConnectionSocketFactory = sslConfig.toSSLConnectionSocketFactory();
Expand Down Expand Up @@ -321,7 +321,7 @@ public void testPemHostnameVerificationOff() throws Exception {
.build();
Path configPath = rootCaPemPath.getParent();

SettingsBasedSSLConfiguratorV5 sbsc = new SettingsBasedSSLConfiguratorV5(settings, configPath, "prefix");
SettingsBasedSSLConfiguratorV4 sbsc = new SettingsBasedSSLConfiguratorV4(settings, configPath, "prefix");

SSLConfig sslConfig = sbsc.buildSSLConfig();
SSLConnectionSocketFactory sslConnectionSocketFactory = sslConfig.toSSLConnectionSocketFactory();
Expand Down Expand Up @@ -361,7 +361,7 @@ public void testJksTrust() throws Exception {
.build();
Path configPath = rootCaJksPath.getParent();

SettingsBasedSSLConfiguratorV5 sbsc = new SettingsBasedSSLConfiguratorV5(settings, configPath, "prefix");
SettingsBasedSSLConfiguratorV4 sbsc = new SettingsBasedSSLConfiguratorV4(settings, configPath, "prefix");

SSLConfig sslConfig = sbsc.buildSSLConfig();
SSLConnectionSocketFactory sslConnectionSocketFactory = sslConfig.toSSLConnectionSocketFactory();
Expand Down Expand Up @@ -402,7 +402,7 @@ public void testJksWrongTrust() throws Exception {
.build();
Path configPath = rootCaJksPath.getParent();

SettingsBasedSSLConfiguratorV5 sbsc = new SettingsBasedSSLConfiguratorV5(settings, configPath, "prefix");
SettingsBasedSSLConfiguratorV4 sbsc = new SettingsBasedSSLConfiguratorV4(settings, configPath, "prefix");

SSLConfig sslConfig = sbsc.buildSSLConfig();
SSLConnectionSocketFactory sslConnectionSocketFactory = sslConfig.toSSLConnectionSocketFactory();
Expand Down Expand Up @@ -440,7 +440,7 @@ public void testTrustAll() throws Exception {
.build();
Path configPath = rootCaJksPath.getParent();

SettingsBasedSSLConfiguratorV5 sbsc = new SettingsBasedSSLConfiguratorV5(settings, configPath, "prefix");
SettingsBasedSSLConfiguratorV4 sbsc = new SettingsBasedSSLConfiguratorV4(settings, configPath, "prefix");

SSLConfig sslConfig = sbsc.buildSSLConfig();
SSLConnectionSocketFactory sslConnectionSocketFactory = sslConfig.toSSLConnectionSocketFactory();
Expand Down

0 comments on commit 31cb3e0

Please sign in to comment.