Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions app/(dashboard)/oidc/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function providerToFormValues(provider: OidcConfigProvider): OidcProviderFormVal
client_id: provider.client_id,
client_secret: "",
scopes: provider.scopes.join(","),
other_audiences: provider.other_audiences.join(","),
redirect_uri: provider.redirect_uri,
redirect_uri_dynamic: provider.redirect_uri_dynamic,
claim_name: provider.claim_name,
Expand All @@ -49,8 +50,8 @@ function trimOrEmpty(value: string) {
return value.trim()
}

function parseScopes(scopes: string) {
return scopes
function parseList(values: string) {
return values
.split(",")
.map((item) => item.trim())
.filter(Boolean)
Expand Down Expand Up @@ -79,7 +80,7 @@ function validateForm(
const clientId = trimOrEmpty(values.client_id)
const clientSecret = trimOrEmpty(values.client_secret)
const redirectUri = trimOrEmpty(values.redirect_uri)
const scopes = parseScopes(values.scopes)
const scopes = parseList(values.scopes)

if (options.requireProviderId) {
if (!providerId) {
Expand Down Expand Up @@ -124,7 +125,8 @@ function buildSavePayload(values: OidcProviderFormValues): SaveOidcConfigPayload
display_name: trimOrEmpty(values.display_name),
config_url: trimOrEmpty(values.config_url),
client_id: trimOrEmpty(values.client_id),
scopes: parseScopes(values.scopes),
scopes: parseList(values.scopes),
other_audiences: parseList(values.other_audiences),
redirect_uri: trimOrEmpty(values.redirect_uri),
redirect_uri_dynamic: values.redirect_uri_dynamic,
claim_name: trimOrEmpty(values.claim_name),
Expand All @@ -150,7 +152,8 @@ function buildValidatePayload(values: OidcProviderFormValues): ValidateOidcConfi
config_url: trimOrEmpty(values.config_url),
client_id: trimOrEmpty(values.client_id),
client_secret: trimOrEmpty(values.client_secret),
scopes: parseScopes(values.scopes),
scopes: parseList(values.scopes),
other_audiences: parseList(values.other_audiences),
redirect_uri: trimOrEmpty(values.redirect_uri),
redirect_uri_dynamic: values.redirect_uri_dynamic,
}
Expand Down
15 changes: 15 additions & 0 deletions components/oidc/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,21 @@ export function OidcForm({
<FieldError>{errors.scopes}</FieldError>
</Field>

<Field className="md:col-span-2">
<FieldLabel htmlFor="other_audiences">{t("Other Audiences")}</FieldLabel>
<FieldContent>
<Input
id="other_audiences"
value={values.other_audiences}
onChange={(event) => onChange("other_audiences", event.target.value)}
placeholder=""
disabled={isReadOnly}
/>
</FieldContent>
<FieldDescription>{t("Comma-separated audience IDs.")}</FieldDescription>
<FieldError>{errors.other_audiences}</FieldError>
</Field>

<Field orientation="responsive" className="items-start gap-3 rounded-md border p-3">
<FieldLabel htmlFor="redirect_uri_dynamic">{t("Use Dynamic Redirect URI")}</FieldLabel>
<FieldContent className="gap-2">
Expand Down
5 changes: 5 additions & 0 deletions types/oidc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface OidcConfigProvider {
client_id: string
client_secret_configured: boolean
scopes: string[]
other_audiences: string[]
redirect_uri: string
redirect_uri_dynamic: boolean
claim_name: string
Expand All @@ -34,6 +35,7 @@ export interface SaveOidcConfigPayload {
client_id: string
client_secret?: string
scopes: string[]
other_audiences: string[]
redirect_uri: string
redirect_uri_dynamic: boolean
claim_name: string
Expand Down Expand Up @@ -63,6 +65,7 @@ export interface ValidateOidcConfigPayload {
client_id: string
client_secret: string
scopes: string[]
other_audiences: string[]
redirect_uri: string
redirect_uri_dynamic: boolean
}
Expand All @@ -83,6 +86,7 @@ export interface OidcProviderFormValues {
client_id: string
client_secret: string
scopes: string
other_audiences: string
redirect_uri: string
redirect_uri_dynamic: boolean
claim_name: string
Expand All @@ -104,6 +108,7 @@ export const DEFAULT_OIDC_FORM_VALUES: OidcProviderFormValues = {
client_id: "",
client_secret: "",
scopes: "openid,profile,email",
other_audiences: "",
redirect_uri: "",
redirect_uri_dynamic: false,
claim_name: "groups",
Expand Down
Loading