ayush786hack commented on code in PR #13676:
URL: https://github.com/apache/gravitino/pull/13676#discussion_r4243767983
##########
clients/client-java/src/test/java/org/apache/gravitino/client/TestOAuth2TokenProvider.java:
##########
@@ -184,4 +186,71 @@ public void testTokenNotFetchedWhenValid() throws
Exception {
String oldToken = provider.getAccessToken();
Assertions.assertEquals(accessToken, oldToken);
}
+
+ @Test
+ public void testClientSecretBasicAuthentication() throws Exception {
+ OAuth2TokenProvider.Builder builder =
+ DefaultOAuth2TokenProvider.builder()
+ .withUri(String.format("http://127.0.0.1:%d", PORT))
+ .withCredential("clientId:clientSecret")
+ .withPath("oauth/token")
+ .withScope("test")
+
.withClientAuthenticationMethod(OAuth2ClientAuthenticationMethod.CLIENT_SECRET_BASIC);
+
+ OAuth2TokenResponse response =
+ new OAuth2TokenResponse("access-token", "refresh-token", "bearer",
3600, "test", null);
+ String respJson =
ObjectMapperProvider.objectMapper().writeValueAsString(response);
+
+ String basicAuth =
Review Comment:
Fixed. I added `testClientSecretBasicEncodesReservedCharacters` to the Java
OAuth2 token-provider tests, using the same reserved-character credential
vector as the Python test (`client*@id:s ecret:/+?~`). The test verifies the
expected Basic Authorization header and confirms that `client_id` and
`client_secret` are absent from the request body. All 7 Java OAuth2 provider
tests pass. Thanks for the suggestion!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]