Skip to content

Commit c13eb8e

Browse files
authored
Add CLI option tenant ID for oauth2 source (#22769)
Fixes #22713
1 parent 50111c7 commit c13eb8e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

cmd/admin.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,11 @@ var (
308308
Value: "false",
309309
Usage: "Use custom URLs for GitLab/GitHub OAuth endpoints",
310310
},
311+
cli.StringFlag{
312+
Name: "custom-tenant-id",
313+
Value: "",
314+
Usage: "Use custom Tenant ID for OAuth endpoints",
315+
},
311316
cli.StringFlag{
312317
Name: "custom-auth-url",
313318
Value: "",
@@ -829,6 +834,7 @@ func parseOAuth2Config(c *cli.Context) *oauth2.Source {
829834
AuthURL: c.String("custom-auth-url"),
830835
ProfileURL: c.String("custom-profile-url"),
831836
EmailURL: c.String("custom-email-url"),
837+
Tenant: c.String("custom-tenant-id"),
832838
}
833839
} else {
834840
customURLMapping = nil
@@ -938,6 +944,7 @@ func runUpdateOauth(c *cli.Context) error {
938944
customURLMapping.AuthURL = oAuth2Config.CustomURLMapping.AuthURL
939945
customURLMapping.ProfileURL = oAuth2Config.CustomURLMapping.ProfileURL
940946
customURLMapping.EmailURL = oAuth2Config.CustomURLMapping.EmailURL
947+
customURLMapping.Tenant = oAuth2Config.CustomURLMapping.Tenant
941948
}
942949
if c.IsSet("use-custom-urls") && c.IsSet("custom-token-url") {
943950
customURLMapping.TokenURL = c.String("custom-token-url")
@@ -955,6 +962,10 @@ func runUpdateOauth(c *cli.Context) error {
955962
customURLMapping.EmailURL = c.String("custom-email-url")
956963
}
957964

965+
if c.IsSet("use-custom-urls") && c.IsSet("custom-tenant-id") {
966+
customURLMapping.Tenant = c.String("custom-tenant-id")
967+
}
968+
958969
oAuth2Config.CustomURLMapping = customURLMapping
959970
source.Cfg = oAuth2Config
960971

docs/content/doc/usage/command-line.en-us.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ Admin operations:
124124
- `--secret`: Client Secret.
125125
- `--auto-discover-url`: OpenID Connect Auto Discovery URL (only required when using OpenID Connect as provider).
126126
- `--use-custom-urls`: Use custom URLs for GitLab/GitHub OAuth endpoints.
127+
- `--custom-tenant-id`: Use custom Tenant ID for OAuth endpoints.
127128
- `--custom-auth-url`: Use a custom Authorization URL (option for GitLab/GitHub).
128129
- `--custom-token-url`: Use a custom Token URL (option for GitLab/GitHub).
129130
- `--custom-profile-url`: Use a custom Profile URL (option for GitLab/GitHub).
@@ -147,6 +148,7 @@ Admin operations:
147148
- `--secret`: Client Secret.
148149
- `--auto-discover-url`: OpenID Connect Auto Discovery URL (only required when using OpenID Connect as provider).
149150
- `--use-custom-urls`: Use custom URLs for GitLab/GitHub OAuth endpoints.
151+
- `--custom-tenant-id`: Use custom Tenant ID for OAuth endpoints.
150152
- `--custom-auth-url`: Use a custom Authorization URL (option for GitLab/GitHub).
151153
- `--custom-token-url`: Use a custom Token URL (option for GitLab/GitHub).
152154
- `--custom-profile-url`: Use a custom Profile URL (option for GitLab/GitHub).

0 commit comments

Comments
 (0)