Skip to content

Commit 742f1b1

Browse files
authored
Improve support for Azure AD OAuth 2.0 (#634)
- rename scopes param to scope
1 parent 161f4ff commit 742f1b1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pulsar/internal/auth/oauth2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const (
3636
ConfigParamTypeClientCredentials = "client_credentials"
3737
ConfigParamIssuerURL = "issuerUrl"
3838
ConfigParamAudience = "audience"
39-
ConfigParamScopes = "scopes"
39+
ConfigParamScope = "scope"
4040
ConfigParamKeyFile = "privateKey"
4141
ConfigParamClientID = "clientId"
4242
)
@@ -64,7 +64,7 @@ func NewAuthenticationOAuth2WithParams(params map[string]string) (Provider, erro
6464
case ConfigParamTypeClientCredentials:
6565
flow, err := oauth2.NewDefaultClientCredentialsFlow(oauth2.ClientCredentialsFlowOptions{
6666
KeyFile: params[ConfigParamKeyFile],
67-
AdditionalScopes: strings.Split(params[ConfigParamScopes], " "),
67+
AdditionalScopes: strings.Split(params[ConfigParamScope], " "),
6868
})
6969
if err != nil {
7070
return nil, err

pulsar/internal/auth/oauth2_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,15 @@ func TestNewAuthenticationOAuth2WithParams(t *testing.T) {
9898
ConfigParamClientID: "client-id",
9999
ConfigParamAudience: "audience",
100100
ConfigParamKeyFile: kf,
101-
ConfigParamScopes: "profile",
101+
ConfigParamScope: "profile",
102102
},
103103
{
104104
ConfigParamType: ConfigParamTypeClientCredentials,
105105
ConfigParamIssuerURL: server.URL,
106106
ConfigParamClientID: "client-id",
107107
ConfigParamAudience: "audience",
108108
ConfigParamKeyFile: fmt.Sprintf("file://%s", kf),
109-
ConfigParamScopes: "profile",
109+
ConfigParamScope: "profile",
110110
},
111111
{
112112
ConfigParamType: ConfigParamTypeClientCredentials,
@@ -120,7 +120,7 @@ func TestNewAuthenticationOAuth2WithParams(t *testing.T) {
120120
"client_email":"[email protected]",
121121
"issuer_url":"%s"
122122
}`, server.URL),
123-
ConfigParamScopes: "profile",
123+
ConfigParamScope: "profile",
124124
},
125125
}
126126

0 commit comments

Comments
 (0)