diff --git a/src/main/java/com/amazon/dlic/auth/http/saml/HTTPSamlAuthenticator.java b/src/main/java/com/amazon/dlic/auth/http/saml/HTTPSamlAuthenticator.java index 6cd933f02e..c07ec8a769 100644 --- a/src/main/java/com/amazon/dlic/auth/http/saml/HTTPSamlAuthenticator.java +++ b/src/main/java/com/amazon/dlic/auth/http/saml/HTTPSamlAuthenticator.java @@ -338,12 +338,12 @@ private Settings createJwtAuthenticatorSettings(Settings settings) { settingsBuilder.put(jwtSettings); - if (jwtSettings.get("roles_key") == null) { - settingsBuilder.put("roles_key", settings.get("roles_key", "roles")); + if (jwtSettings.get("roles_key") == null && settings.get("roles_key") != null) { + settingsBuilder.put("roles_key", "roles"); } if (jwtSettings.get("subject_key") == null) { - settingsBuilder.put("subject_key", settings.get("subject_key", "sub")); + settingsBuilder.put("subject_key", "sub"); } return settingsBuilder.build(); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/security/auditlog/sink/WebhookAuditLogTest.java b/src/test/java/com/amazon/opendistroforelasticsearch/security/auditlog/sink/WebhookAuditLogTest.java index 915fa247f6..c4adf3ae8d 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/security/auditlog/sink/WebhookAuditLogTest.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/security/auditlog/sink/WebhookAuditLogTest.java @@ -444,11 +444,11 @@ public void httpsTest() throws Exception { @Test public void httpsTestPemDefault() throws Exception { - + final int port = 8088; TestHttpHandler handler = new TestHttpHandler(); server = ServerBootstrap.bootstrap() - .setListenerPort(8084) + .setListenerPort(port) .setServerInfo("Test/1.1") .setSslContext(createSSLContext()) .registerHandler("*", handler) @@ -458,7 +458,7 @@ public void httpsTestPemDefault() throws Exception { AuditMessage msg = MockAuditMessageFactory.validAuditMessage(); LoggingSink fallback = new LoggingSink("test", Settings.EMPTY, null, null); - String url = "https://localhost:8084/endpoint"; + String url = "https://localhost:" + port + "/endpoint"; // test default with filepath handler.reset();