Skip to content

Commit

Permalink
refactor(schemas): add the providerType to the providerDetails return…
Browse files Browse the repository at this point in the history
… type

add the new providerType property to the providerDetails return type
  • Loading branch information
simeng-li committed Mar 27, 2024
1 parent f1fd1a3 commit 44bf8e3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/schemas/src/types/sso-connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export type SupportedSsoConnector = Omit<SsoConnector, 'providerName'> & {

const ssoConnectorProviderDetailGuard = z.object({
providerName: z.nativeEnum(SsoProviderName),
providerType: z.nativeEnum(SsoProviderType),
logo: z.string(),
logoDark: z.string(),
description: z.string(),
Expand All @@ -70,15 +71,18 @@ export type SsoConnectorProvidersResponse = z.infer<typeof ssoConnectorProviders

// API response guard for all the SSO connectors CRUD APIs
export const ssoConnectorWithProviderConfigGuard = SsoConnectors.guard
.omit({ providerName: true })
// Must be a supported SSO provider name. Overwrite the providerName string type to enum.
.extend({ providerName: z.nativeEnum(SsoProviderName) })
.merge(
// Static provider configs defined in the SSO factory.
// Static provider details
z.object({
name: z.string(), // For display purpose, generate from i18n key name defined by SSO factory.
providerName: z.nativeEnum(SsoProviderName), // Must be a supported SSO provider name.
name: z.string(),
providerType: z.nativeEnum(SsoProviderType),
providerLogo: z.string(),
providerLogoDark: z.string(),
// SSO connection config parsed from the provider.
// - OIDC: connection config fetched from the OIDC provider.
// - SAML: connection config fetched from the metadata url or metadata file.
providerConfig: z.record(z.unknown()).optional(),
})
);
Expand Down

0 comments on commit 44bf8e3

Please sign in to comment.