forked from opensearch-project/security
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Stephen Crawford <[email protected]>
- Loading branch information
1 parent
4bbbc37
commit 2110225
Showing
140 changed files
with
11,773 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
src/integrationTest/java/org/opensearch/test/framework/AuditCompliance.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
*/ | ||
package org.opensearch.test.framework; | ||
|
||
import java.io.IOException; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import org.opensearch.core.xcontent.ToXContentObject; | ||
import org.opensearch.core.xcontent.XContentBuilder; | ||
|
||
public class AuditCompliance implements ToXContentObject { | ||
|
||
private boolean enabled = false; | ||
|
||
private Boolean writeLogDiffs; | ||
|
||
private List<String> readIgnoreUsers; | ||
|
||
private List<String> writeWatchedIndices; | ||
|
||
private List<String> writeIgnoreUsers; | ||
|
||
private Boolean readMetadataOnly; | ||
|
||
private Boolean writeMetadataOnly; | ||
|
||
private Boolean externalConfig; | ||
|
||
private Boolean internalConfig; | ||
|
||
public AuditCompliance enabled(boolean enabled) { | ||
this.enabled = enabled; | ||
this.writeLogDiffs = false; | ||
this.readIgnoreUsers = Collections.emptyList(); | ||
this.writeWatchedIndices = Collections.emptyList(); | ||
this.writeIgnoreUsers = Collections.emptyList(); | ||
this.readMetadataOnly = false; | ||
this.writeMetadataOnly = false; | ||
this.externalConfig = false; | ||
this.internalConfig = false; | ||
return this; | ||
} | ||
|
||
public AuditCompliance writeLogDiffs(boolean writeLogDiffs) { | ||
this.writeLogDiffs = writeLogDiffs; | ||
return this; | ||
} | ||
|
||
public AuditCompliance readIgnoreUsers(List<String> list) { | ||
this.readIgnoreUsers = list; | ||
return this; | ||
} | ||
|
||
public AuditCompliance writeWatchedIndices(List<String> list) { | ||
this.writeWatchedIndices = list; | ||
return this; | ||
} | ||
|
||
public AuditCompliance writeIgnoreUsers(List<String> list) { | ||
this.writeIgnoreUsers = list; | ||
return this; | ||
} | ||
|
||
public AuditCompliance readMetadataOnly(boolean readMetadataOnly) { | ||
this.readMetadataOnly = readMetadataOnly; | ||
return this; | ||
} | ||
|
||
public AuditCompliance writeMetadataOnly(boolean writeMetadataOnly) { | ||
this.writeMetadataOnly = writeMetadataOnly; | ||
return this; | ||
} | ||
|
||
public AuditCompliance externalConfig(boolean externalConfig) { | ||
this.externalConfig = externalConfig; | ||
return this; | ||
} | ||
|
||
public AuditCompliance internalConfig(boolean internalConfig) { | ||
this.internalConfig = internalConfig; | ||
return this; | ||
} | ||
|
||
@Override | ||
public XContentBuilder toXContent(XContentBuilder xContentBuilder, Params params) throws IOException { | ||
xContentBuilder.startObject(); | ||
xContentBuilder.field("enabled", enabled); | ||
xContentBuilder.field("write_log_diffs", writeLogDiffs); | ||
xContentBuilder.field("read_ignore_users", readIgnoreUsers); | ||
xContentBuilder.field("write_watched_indices", writeWatchedIndices); | ||
xContentBuilder.field("write_ignore_users", writeIgnoreUsers); | ||
xContentBuilder.field("read_metadata_only", readMetadataOnly); | ||
xContentBuilder.field("write_metadata_only", writeMetadataOnly); | ||
xContentBuilder.field("external_config", externalConfig); | ||
xContentBuilder.field("internal_config", internalConfig); | ||
xContentBuilder.endObject(); | ||
return xContentBuilder; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
src/integrationTest/java/org/opensearch/test/framework/AuditConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
*/ | ||
package org.opensearch.test.framework; | ||
|
||
import java.io.IOException; | ||
|
||
import org.opensearch.core.xcontent.ToXContentObject; | ||
import org.opensearch.core.xcontent.XContentBuilder; | ||
|
||
public class AuditConfiguration implements ToXContentObject { | ||
private final boolean enabled; | ||
|
||
private AuditFilters filters; | ||
|
||
private AuditCompliance compliance; | ||
|
||
public AuditConfiguration(boolean enabled) { | ||
this.filters = new AuditFilters(); | ||
this.compliance = new AuditCompliance(); | ||
this.enabled = enabled; | ||
} | ||
|
||
public boolean isEnabled() { | ||
return enabled; | ||
} | ||
|
||
public AuditConfiguration filters(AuditFilters filters) { | ||
this.filters = filters; | ||
return this; | ||
} | ||
|
||
public AuditConfiguration compliance(AuditCompliance auditCompliance) { | ||
this.compliance = auditCompliance; | ||
return this; | ||
} | ||
|
||
@Override | ||
public XContentBuilder toXContent(XContentBuilder xContentBuilder, Params params) throws IOException { | ||
// json built here must be deserialized to org.opensearch.security.auditlog.config.AuditConfig | ||
xContentBuilder.startObject(); | ||
xContentBuilder.field("enabled", enabled); | ||
|
||
xContentBuilder.field("audit", filters); | ||
xContentBuilder.field("compliance", compliance); | ||
|
||
xContentBuilder.endObject(); | ||
return xContentBuilder; | ||
} | ||
} |
Oops, something went wrong.