pulsar-client-go
pulsar-client-go copied to clipboard
Set `client_credentials` as the default OAuth2 grant type.
Is your feature request related to a problem? Please describe.
Currently, the go client doesn't support setup OAuth2 params without the grant type to be specified.
The broker only supports the client_credentials grant type. It would be better to make this the default grant type for the Go client. This change would align the Go client's behavior with that of the Java client.
Describe the solution you'd like
Set client_credentials as the default OAuth2 grant type.
Describe alternatives you've considered None yet
Additional context None
Currently, Pulsar clients only support the client_credentials authentication type. The authentication type determines how to obtain an access token through an OAuth 2.0 authorization service.
https://pulsar.apache.org/docs/3.3.x/security-oauth2/#configure-oauth2-authentication-in-pulsar-clients
Since the latest pulsar version only support using client_credentials as an authentication type in OAuth, I think we can stay consistent with Java client. Maybe we need to handle params[ConfigParamType] return nil or empty string cases in NewAuthenticationOAuth2WithParams() function.
Besides, these code seems to be duplicated from pulsar/auth/oauth2.go to pulsaradmin/pkg/admin/auth/oauth2.go, I think we may need to change these code snippets together.