From a272ccbb39ae62f8f1ce5f1bbbce787067ab02e1 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Wed, 23 Aug 2023 19:34:56 -0700 Subject: [PATCH] Rename the obo endpoint Signed-off-by: Ryan Liang --- .../security/http/OnBehalfOfJwtAuthenticationTest.java | 2 +- .../org/opensearch/test/framework/cluster/TestRestClient.java | 2 +- .../security/action/onbehalf/CreateOnBehalfOfTokenAction.java | 2 +- .../org/opensearch/security/http/OnBehalfOfAuthenticator.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/integrationTest/java/org/opensearch/security/http/OnBehalfOfJwtAuthenticationTest.java b/src/integrationTest/java/org/opensearch/security/http/OnBehalfOfJwtAuthenticationTest.java index 5dc9532f1f..4fc5b059ea 100644 --- a/src/integrationTest/java/org/opensearch/security/http/OnBehalfOfJwtAuthenticationTest.java +++ b/src/integrationTest/java/org/opensearch/security/http/OnBehalfOfJwtAuthenticationTest.java @@ -63,7 +63,7 @@ public class OnBehalfOfJwtAuthenticationTest { public static final String DEFAULT_PASSWORD = "secret"; public static final String NEW_PASSWORD = "testPassword123!!"; public static final String OBO_TOKEN_REASON = "{\"reason\":\"Test generation\"}"; - public static final String OBO_ENDPOINT_PREFIX = "_plugins/_security/api/generateobotoken"; + public static final String OBO_ENDPOINT_PREFIX = "_plugins/_security/api/generateonbehalfoftoken"; public static final String OBO_DESCRIPTION = "{\"description\":\"Testing\", \"service\":\"self-issued\"}"; public static final String CURRENT_AND_NEW_PASSWORDS = "{ \"current_password\": \"" + DEFAULT_PASSWORD diff --git a/src/integrationTest/java/org/opensearch/test/framework/cluster/TestRestClient.java b/src/integrationTest/java/org/opensearch/test/framework/cluster/TestRestClient.java index 636c2742cc..eff2a1db9c 100644 --- a/src/integrationTest/java/org/opensearch/test/framework/cluster/TestRestClient.java +++ b/src/integrationTest/java/org/opensearch/test/framework/cluster/TestRestClient.java @@ -138,7 +138,7 @@ public HttpResponse getAuthInfo(Header... headers) { public HttpResponse getOnBehalfOfToken(String jsonData, Header... headers) { try { HttpPost httpPost = new HttpPost( - new URIBuilder(getHttpServerUri() + "/_plugins/_security/api/generateobotoken?pretty").build() + new URIBuilder(getHttpServerUri() + "/_plugins/_security/api/generateonbehalfoftoken?pretty").build() ); httpPost.setEntity(toStringEntity(jsonData)); return executeRequest(httpPost, mergeHeaders(CONTENT_TYPE_JSON, headers)); diff --git a/src/main/java/org/opensearch/security/action/onbehalf/CreateOnBehalfOfTokenAction.java b/src/main/java/org/opensearch/security/action/onbehalf/CreateOnBehalfOfTokenAction.java index e0e8dc0494..48a06ce13e 100644 --- a/src/main/java/org/opensearch/security/action/onbehalf/CreateOnBehalfOfTokenAction.java +++ b/src/main/java/org/opensearch/security/action/onbehalf/CreateOnBehalfOfTokenAction.java @@ -45,7 +45,7 @@ public class CreateOnBehalfOfTokenAction extends BaseRestHandler { private static final List routes = addRoutesPrefix( - ImmutableList.of(new NamedRoute.Builder().method(POST).path("/generateobotoken").uniqueName("security:obo/create").build()), + ImmutableList.of(new NamedRoute.Builder().method(POST).path("/generateonbehalfoftoken").uniqueName("security:obo/create").build()), "/_plugins/_security/api" ); diff --git a/src/main/java/org/opensearch/security/http/OnBehalfOfAuthenticator.java b/src/main/java/org/opensearch/security/http/OnBehalfOfAuthenticator.java index 3f2cb67052..1fcc036f19 100644 --- a/src/main/java/org/opensearch/security/http/OnBehalfOfAuthenticator.java +++ b/src/main/java/org/opensearch/security/http/OnBehalfOfAuthenticator.java @@ -48,7 +48,7 @@ public class OnBehalfOfAuthenticator implements HTTPAuthenticator { private static final String REGEX_PATH_PREFIX = "/(" + LEGACY_OPENDISTRO_PREFIX + "|" + PLUGINS_PREFIX + ")/" + "(.*)"; private static final Pattern PATTERN_PATH_PREFIX = Pattern.compile(REGEX_PATH_PREFIX); - private static final String ON_BEHALF_OF_SUFFIX = "api/generateobotoken"; + private static final String ON_BEHALF_OF_SUFFIX = "api/generateonbehalfoftoken"; private static final String ACCOUNT_SUFFIX = "api/account"; protected final Logger log = LogManager.getLogger(this.getClass());