Skip to content

Commit

Permalink
Prohibit configuring roles file via configFile() method
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-vieira committed Dec 2, 2024
1 parent 9d27436 commit a272e2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,10 @@ private void writeConfiguration() {

private void copyExtraConfigFiles() {
spec.getExtraConfigFiles().forEach((fileName, resource) -> {
if (fileName.equals("roles.yml")) {
throw new IllegalArgumentException("Security roles should be configured via 'rolesFile()' method.");
}

final Path target = configDir.resolve(fileName);
final Path directory = target.getParent();
if (Files.exists(directory) == false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static ElasticsearchCluster getCluster() {
.setting("xpack.license.self_generated.type", "basic")
.setting("xpack.monitoring.collection.enabled", "true")
.setting("xpack.security.enabled", "true")
.configFile("roles.yml", Resource.fromClasspath("roles.yml"))
.rolesFile(Resource.fromClasspath("roles.yml"))
.user("test-admin", "x-pack-test-password", "test-admin", false)
.user("user1", "x-pack-test-password", "user1", false)
.user("user2", "x-pack-test-password", "user2", false)
Expand Down

0 comments on commit a272e2f

Please sign in to comment.