ayush786hack commented on code in PR #13676:
URL: https://github.com/apache/gravitino/pull/13676#discussion_r4243773616
##########
clients/client-python/gravitino/auth/default_oauth2_token_provider.py:
##########
@@ -103,16 +111,45 @@ def _parse_credential(self):
def _fetch_token(self) -> str:
client_id, client_secret = self._parse_credential()
- client_credential_request = OAuth2ClientCredentialRequest(
- grant_type=CLIENT_CREDENTIALS,
- client_id=client_id,
- client_secret=client_secret,
- scope=self._scope,
- )
+ headers = {}
+
+ if (
+ self._authentication_method
+ == OAuth2ClientAuthenticationMethod.CLIENT_SECRET_BASIC
+ ):
+ if not client_id or not client_id.strip():
+ raise IllegalArgumentException(
+ "client_id must be set when using client_secret_basic
authentication"
+ )
+
+ encoded_client_id = quote_plus(client_id, safe="")
Review Comment:
Fixed. Python now uses `quote_plus(value, safe="*").replace("~", "%7E")` for
each credential component, matching Java's `URLEncoder` behavior for the
reserved characters covered by the tests. Both clients use the same credential
test vector, `client*@id:s ecret:/+?~`, and produce the same expected Basic
Authorization header. All 9 Python OAuth2 provider tests and all 7 Java OAuth2
provider tests pass. Thanks for pointing this out!
--
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]