Skip to content

Commit

Permalink
merge errors
Browse files Browse the repository at this point in the history
Signed-off-by: scosta <samuel.costa@eliatra.com>
  • Loading branch information
samuelcostae committed May 16, 2023
1 parent e12f8e6 commit 64092cf
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,24 @@
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpStatus;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import org.opensearch.common.settings.Settings;
import org.opensearch.rest.RestStatus;
import org.opensearch.security.test.DynamicSecurityConfig;
import org.opensearch.security.test.SingleClusterTest;
import org.opensearch.security.test.helper.rest.RestHelper;

import static org.junit.Assert.assertEquals;

public class PrivilegesEvaluatorTest extends SingleClusterTest {
private static final Header NegativeLookaheadUserHeader = encodeBasicHeader("negative_lookahead_user", "negative_lookahead_user");
private static final Header NegatedRegexUserHeader = encodeBasicHeader("negated_regex_user", "negated_regex_user");

private static final String allAccessUser = "admin_all_access";
private static final Header allAccessUserHeader = encodeBasicHeader(allAccessUser, allAccessUser);
@Before
public void setupSettingsIndexPattern() throws Exception {
Settings settings = Settings.builder()
.put("plugins.security.system_indices.indices", ".testSystemExtensionIndex")
Expand All @@ -46,7 +53,6 @@ public void setupSettingsIndexPattern() throws Exception {

@Test
public void testNegativeLookaheadPattern() throws Exception {
setupSettingsIndexPattern();

RestHelper rh = nonSslRestHelper();
RestHelper.HttpResponse response = rh.executeGetRequest( "*/_search", NegativeLookaheadUserHeader);
Expand All @@ -57,8 +63,6 @@ public void testNegativeLookaheadPattern() throws Exception {

@Test
public void testRegexPattern() throws Exception {
setupSettingsIndexPattern();

RestHelper rh = nonSslRestHelper();
RestHelper.HttpResponse response = rh.executeGetRequest( "*/_search", NegatedRegexUserHeader);
Assert.assertEquals(HttpStatus.SC_FORBIDDEN, response.getStatusCode());
Expand Down

0 comments on commit 64092cf

Please sign in to comment.