Skip to content

Commit 23dc332

Browse files
authored
Merge pull request #309 from bachmanity1/add-scopes-config
Allow specifying scopes in oauth config
2 parents daaf2e8 + 0e38e57 commit 23dc332

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

cmd/kaf/oauth.go

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func newTokenProvider() *tokenProvider {
5555
ClientID: cluster.SASL.ClientID,
5656
ClientSecret: cluster.SASL.ClientSecret,
5757
TokenURL: cluster.SASL.TokenURL,
58+
Scopes: cluster.SASL.Scopes,
5859
},
5960
staticToken: false,
6061
}

examples/sasl_ssl_oauth.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ clusters:
77
clientID: my_client_oauth
88
clientSecret: my_secret_oauth
99
tokenURL: https//some.token.endpoint.com/token
10+
scopes:
11+
- scope1
12+
- scope2
1013
TLS:
1114
insecure: true
1215
security-protocol: SASL_SSL

pkg/config/config.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ import (
1010
)
1111

1212
type SASL struct {
13-
Mechanism string `yaml:"mechanism"`
14-
Username string `yaml:"username"`
15-
Password string `yaml:"password"`
16-
ClientID string `yaml:"clientID"`
17-
ClientSecret string `yaml:"clientSecret"`
18-
TokenURL string `yaml:"tokenURL"`
19-
Token string `yaml:"token"`
20-
Version int16 `yaml:"version"`
13+
Mechanism string `yaml:"mechanism"`
14+
Username string `yaml:"username"`
15+
Password string `yaml:"password"`
16+
ClientID string `yaml:"clientID"`
17+
ClientSecret string `yaml:"clientSecret"`
18+
TokenURL string `yaml:"tokenURL"`
19+
Scopes []string `yaml:"scopes"`
20+
Token string `yaml:"token"`
21+
Version int16 `yaml:"version"`
2122
}
2223

2324
type TLS struct {

0 commit comments

Comments
 (0)