forked from opensearch-project/security-analytics
-
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.
added secure correlation alerts tests
Signed-off-by: Riya Saxena <riysaxen@amazon.com>
- Loading branch information
1 parent
81ef997
commit 95a8125
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
.../org/opensearch/securityanalytics/correlation/alerts/SecureCorrelationAlertsRestAPIT.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,34 @@ | ||
package org.opensearch.securityanalytics.correlation.alerts; | ||
|
||
import org.apache.hc.core5.http.HttpHost; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.opensearch.client.RestClient; | ||
import org.opensearch.commons.rest.SecureRestClientBuilder; | ||
import org.opensearch.securityanalytics.SecurityAnalyticsRestTestCase; | ||
import java.io.IOException; | ||
|
||
public class SecureCorrelationAlertsRestAPIT { | ||
static String SECURITY_ANALYTICS_FULL_ACCESS_ROLE = "security_analytics_full_access"; | ||
static String SECURITY_ANALYTICS_READ_ACCESS_ROLE = "security_analytics_read_access"; | ||
static String TEST_HR_BACKEND_ROLE = "HR"; | ||
static String TEST_IT_BACKEND_ROLE = "IT"; | ||
private final String user = "userAlert"; | ||
private static final String[] EMPTY_ARRAY = new String[0]; | ||
private RestClient userClient; | ||
|
||
@Before | ||
public void create() throws IOException { | ||
String[] backendRoles = { TEST_HR_BACKEND_ROLE }; | ||
createUserWithData(user, user, SECURITY_ANALYTICS_FULL_ACCESS_ROLE, backendRoles ); | ||
if (userClient == null) { | ||
userClient = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[]{}), isHttps(), user, password).setSocketTimeout(60000).build(); | ||
} | ||
} | ||
|
||
@After | ||
public void cleanup() throws IOException { | ||
userClient.close(); | ||
deleteUser(user); | ||
} | ||
} |