diff --git a/src/integrationTest/java/org/opensearch/security/api/DefaultApiAvailabilityIntegrationTest.java b/src/integrationTest/java/org/opensearch/security/api/DefaultApiAvailabilityIntegrationTest.java index f3b701dc38..f28d1e63f9 100644 --- a/src/integrationTest/java/org/opensearch/security/api/DefaultApiAvailabilityIntegrationTest.java +++ b/src/integrationTest/java/org/opensearch/security/api/DefaultApiAvailabilityIntegrationTest.java @@ -95,16 +95,11 @@ private void verifyAuthInfoApi(final TestRestClient client) throws Exception { @Test public void flushCache() throws Exception { - withUser(NEW_USER, client -> { - forbidden(() -> client.get(apiPath("cache"))); - forbidden(() -> client.postJson(apiPath("cache"), EMPTY_BODY)); - forbidden(() -> client.putJson(apiPath("cache"), EMPTY_BODY)); - forbidden(() -> client.delete(apiPath("cache"))); - }); + withUser(NEW_USER, client -> { forbidden(() -> client.delete(apiPath("cache"))); }); withUser(ADMIN_USER_NAME, localCluster.getAdminCertificate(), client -> { - notImplemented(() -> client.get(apiPath("cache"))); - notImplemented(() -> client.postJson(apiPath("cache"), EMPTY_BODY)); - notImplemented(() -> client.putJson(apiPath("cache"), EMPTY_BODY)); + methodNotAllowed(() -> client.get(apiPath("cache"))); + methodNotAllowed(() -> client.postJson(apiPath("cache"), EMPTY_BODY)); + methodNotAllowed(() -> client.putJson(apiPath("cache"), EMPTY_BODY)); final var response = ok(() -> client.delete(apiPath("cache"))); assertThat(response.getBody(), response.getTextFromJsonBody("/message"), is("Cache flushed successfully.")); }); diff --git a/src/main/java/org/opensearch/security/dlic/rest/api/FlushCacheApiAction.java b/src/main/java/org/opensearch/security/dlic/rest/api/FlushCacheApiAction.java index 2f579ecbd9..0135653524 100644 --- a/src/main/java/org/opensearch/security/dlic/rest/api/FlushCacheApiAction.java +++ b/src/main/java/org/opensearch/security/dlic/rest/api/FlushCacheApiAction.java @@ -36,14 +36,7 @@ public class FlushCacheApiAction extends AbstractApiAction { private final static Logger LOGGER = LogManager.getLogger(FlushCacheApiAction.class); - private static final List routes = addRoutesPrefix( - ImmutableList.of( - new Route(Method.DELETE, "/cache"), - new Route(Method.GET, "/cache"), - new Route(Method.PUT, "/cache"), - new Route(Method.POST, "/cache") - ) - ); + private static final List routes = addRoutesPrefix(ImmutableList.of(new Route(Method.DELETE, "/cache"))); @Inject public FlushCacheApiAction(