Skip to content

Commit f8c09cd

Browse files
committed
Merge branch 'main' of github.com:rustfs/console
2 parents 277f7dc + 192cbd5 commit f8c09cd

3 files changed

Lines changed: 28 additions & 5 deletions

File tree

app/(dashboard)/oidc/page.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function providerToFormValues(provider: OidcConfigProvider): OidcProviderFormVal
3333
client_id: provider.client_id,
3434
client_secret: "",
3535
scopes: provider.scopes.join(","),
36+
other_audiences: provider.other_audiences.join(","),
3637
redirect_uri: provider.redirect_uri,
3738
redirect_uri_dynamic: provider.redirect_uri_dynamic,
3839
claim_name: provider.claim_name,
@@ -49,8 +50,8 @@ function trimOrEmpty(value: string) {
4950
return value.trim()
5051
}
5152

52-
function parseScopes(scopes: string) {
53-
return scopes
53+
function parseList(values: string) {
54+
return values
5455
.split(",")
5556
.map((item) => item.trim())
5657
.filter(Boolean)
@@ -79,7 +80,7 @@ function validateForm(
7980
const clientId = trimOrEmpty(values.client_id)
8081
const clientSecret = trimOrEmpty(values.client_secret)
8182
const redirectUri = trimOrEmpty(values.redirect_uri)
82-
const scopes = parseScopes(values.scopes)
83+
const scopes = parseList(values.scopes)
8384

8485
if (options.requireProviderId) {
8586
if (!providerId) {
@@ -124,7 +125,8 @@ function buildSavePayload(values: OidcProviderFormValues): SaveOidcConfigPayload
124125
display_name: trimOrEmpty(values.display_name),
125126
config_url: trimOrEmpty(values.config_url),
126127
client_id: trimOrEmpty(values.client_id),
127-
scopes: parseScopes(values.scopes),
128+
scopes: parseList(values.scopes),
129+
other_audiences: parseList(values.other_audiences),
128130
redirect_uri: trimOrEmpty(values.redirect_uri),
129131
redirect_uri_dynamic: values.redirect_uri_dynamic,
130132
claim_name: trimOrEmpty(values.claim_name),
@@ -150,7 +152,8 @@ function buildValidatePayload(values: OidcProviderFormValues): ValidateOidcConfi
150152
config_url: trimOrEmpty(values.config_url),
151153
client_id: trimOrEmpty(values.client_id),
152154
client_secret: trimOrEmpty(values.client_secret),
153-
scopes: parseScopes(values.scopes),
155+
scopes: parseList(values.scopes),
156+
other_audiences: parseList(values.other_audiences),
154157
redirect_uri: trimOrEmpty(values.redirect_uri),
155158
redirect_uri_dynamic: values.redirect_uri_dynamic,
156159
}

components/oidc/form.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,21 @@ export function OidcForm({
244244
<FieldError>{errors.scopes}</FieldError>
245245
</Field>
246246

247+
<Field className="md:col-span-2">
248+
<FieldLabel htmlFor="other_audiences">{t("Other Audiences")}</FieldLabel>
249+
<FieldContent>
250+
<Input
251+
id="other_audiences"
252+
value={values.other_audiences}
253+
onChange={(event) => onChange("other_audiences", event.target.value)}
254+
placeholder=""
255+
disabled={isReadOnly}
256+
/>
257+
</FieldContent>
258+
<FieldDescription>{t("Comma-separated audience IDs.")}</FieldDescription>
259+
<FieldError>{errors.other_audiences}</FieldError>
260+
</Field>
261+
247262
<Field orientation="responsive" className="items-start gap-3 rounded-md border p-3">
248263
<FieldLabel htmlFor="redirect_uri_dynamic">{t("Use Dynamic Redirect URI")}</FieldLabel>
249264
<FieldContent className="gap-2">

types/oidc.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface OidcConfigProvider {
1010
client_id: string
1111
client_secret_configured: boolean
1212
scopes: string[]
13+
other_audiences: string[]
1314
redirect_uri: string
1415
redirect_uri_dynamic: boolean
1516
claim_name: string
@@ -34,6 +35,7 @@ export interface SaveOidcConfigPayload {
3435
client_id: string
3536
client_secret?: string
3637
scopes: string[]
38+
other_audiences: string[]
3739
redirect_uri: string
3840
redirect_uri_dynamic: boolean
3941
claim_name: string
@@ -63,6 +65,7 @@ export interface ValidateOidcConfigPayload {
6365
client_id: string
6466
client_secret: string
6567
scopes: string[]
68+
other_audiences: string[]
6669
redirect_uri: string
6770
redirect_uri_dynamic: boolean
6871
}
@@ -83,6 +86,7 @@ export interface OidcProviderFormValues {
8386
client_id: string
8487
client_secret: string
8588
scopes: string
89+
other_audiences: string
8690
redirect_uri: string
8791
redirect_uri_dynamic: boolean
8892
claim_name: string
@@ -104,6 +108,7 @@ export const DEFAULT_OIDC_FORM_VALUES: OidcProviderFormValues = {
104108
client_id: "",
105109
client_secret: "",
106110
scopes: "openid,profile,email",
111+
other_audiences: "",
107112
redirect_uri: "",
108113
redirect_uri_dynamic: false,
109114
claim_name: "groups",

0 commit comments

Comments
 (0)