Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Nils Bandener <[email protected]>
  • Loading branch information
nibix committed Sep 25, 2024
1 parent e997aed commit 2239566
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,23 +300,6 @@ private SecurityDynamicConfiguration<?> toConfig(GetResponse singleGetResponse,
log.debug("Load " + id + " with version " + configVersion);
}

if (CType.ACTIONGROUPS.toLCString().equals(id)) {
try {
return SecurityDynamicConfiguration.fromJson(
jsonAsString,
CType.fromString(id),
configVersion,
seqNo,
primaryTerm,
acceptInvalid
);
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("Unable to load " + id + " with version " + configVersion + " - Try loading legacy format ...");
}
return SecurityDynamicConfiguration.fromJson(jsonAsString, CType.fromString(id), 0, seqNo, primaryTerm, acceptInvalid);
}
}
return SecurityDynamicConfiguration.fromJson(
jsonAsString,
CType.fromString(id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static <T> SecurityDynamicConfiguration<T> fromMap(Map<String, Object> ma

public static void validate(SecurityDynamicConfiguration<?> sdc, int version, CType<?> ctype) throws IOException {
if (version < 2) {
throw new IOException("Config version " + version + " is not supported");
throw new IOException("Config version " + version + " is not supported; config type: " + ctype);
}

if (sdc.get_meta() == null) {
Expand Down
15 changes: 0 additions & 15 deletions src/test/java/org/opensearch/security/SecurityAdminTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -598,21 +598,6 @@ public void testSecurityAdminValidateConfig() throws Exception {
returnCode = SecurityAdmin.execute(argsAsList.toArray(new String[0]));
Assert.assertNotEquals(0, returnCode);

argsAsList = new ArrayList<>();
addDirectoryPath(argsAsList, TEST_RESOURCE_ABSOLUTE_PATH + "legacy/securityconfig_v6");
argsAsList.add("-vc");

returnCode = SecurityAdmin.execute(argsAsList.toArray(new String[0]));
Assert.assertNotEquals(0, returnCode);

argsAsList = new ArrayList<>();
addDirectoryPath(argsAsList, TEST_RESOURCE_ABSOLUTE_PATH + "legacy/securityconfig_v6");
argsAsList.add("-vc");
argsAsList.add("6");

returnCode = SecurityAdmin.execute(argsAsList.toArray(new String[0]));
assertThat(returnCode, is(0));

argsAsList = new ArrayList<>();
addDirectoryPath(argsAsList, TEST_RESOURCE_ABSOLUTE_PATH);
argsAsList.add("-vc");
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/ldap/internal_users.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
_meta:
type: "internalusers"
config_version: 2
admin:
hash: $2a$12$VcCDgh2NDk07JGN0rjGbM.Ad41qVR/YFJcgHp0UGns5JDymv..TOG
#password is: admin

0 comments on commit 2239566

Please sign in to comment.