This is an automated email from the ASF dual-hosted git repository. mmerli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git
The following commit(s) were added to refs/heads/master by this push: new 161f4ff Improve support for Azure AD OAuth 2.0 (#633) 161f4ff is described below commit 161f4ffc41c46f44a6702019a22c576536208cb1 Author: Eron Wright <ewri...@streamnative.io> AuthorDate: Tue Oct 5 11:04:55 2021 -0700 Improve support for Azure AD OAuth 2.0 (#633) - parsing fix for scopes auth param --- pulsar/internal/auth/oauth2.go | 4 ++-- pulsar/internal/auth/oauth2_test.go | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pulsar/internal/auth/oauth2.go b/pulsar/internal/auth/oauth2.go index 924f22f..7fae133 100644 --- a/pulsar/internal/auth/oauth2.go +++ b/pulsar/internal/auth/oauth2.go @@ -36,7 +36,7 @@ const ( ConfigParamTypeClientCredentials = "client_credentials" ConfigParamIssuerURL = "issuerUrl" ConfigParamAudience = "audience" - ConfigParamScope = "scope" + ConfigParamScopes = "scopes" ConfigParamKeyFile = "privateKey" ConfigParamClientID = "clientId" ) @@ -64,7 +64,7 @@ func NewAuthenticationOAuth2WithParams(params map[string]string) (Provider, erro case ConfigParamTypeClientCredentials: flow, err := oauth2.NewDefaultClientCredentialsFlow(oauth2.ClientCredentialsFlowOptions{ KeyFile: params[ConfigParamKeyFile], - AdditionalScopes: strings.Split(params[ConfigParamScope], ""), + AdditionalScopes: strings.Split(params[ConfigParamScopes], " "), }) if err != nil { return nil, err diff --git a/pulsar/internal/auth/oauth2_test.go b/pulsar/internal/auth/oauth2_test.go index 9373aec..a3825e2 100644 --- a/pulsar/internal/auth/oauth2_test.go +++ b/pulsar/internal/auth/oauth2_test.go @@ -98,6 +98,7 @@ func TestNewAuthenticationOAuth2WithParams(t *testing.T) { ConfigParamClientID: "client-id", ConfigParamAudience: "audience", ConfigParamKeyFile: kf, + ConfigParamScopes: "profile", }, { ConfigParamType: ConfigParamTypeClientCredentials, @@ -105,6 +106,7 @@ func TestNewAuthenticationOAuth2WithParams(t *testing.T) { ConfigParamClientID: "client-id", ConfigParamAudience: "audience", ConfigParamKeyFile: fmt.Sprintf("file://%s", kf), + ConfigParamScopes: "profile", }, { ConfigParamType: ConfigParamTypeClientCredentials, @@ -118,6 +120,7 @@ func TestNewAuthenticationOAuth2WithParams(t *testing.T) { "client_email":"oa...@test.org", "issuer_url":"%s" }`, server.URL), + ConfigParamScopes: "profile", }, }