Files
Tom Moor 1a893b0e45 Group sync framework (#11684)
Adds group sync from external authentication providers, allowing team group memberships to be automatically managed based on provider data on sign-in in the future.
2026-03-14 23:02:20 -04:00

52 lines
1.6 KiB
TypeScript

import { z } from "zod";
import { BaseSchema } from "@server/routes/api/schema";
export const AuthenticationProvidersInfoSchema = BaseSchema.extend({
body: z.object({
/** Authentication Provider Id */
id: z.uuid(),
}),
});
export type AuthenticationProvidersInfoReq = z.infer<
typeof AuthenticationProvidersInfoSchema
>;
/** Schema for group sync settings on an authentication provider. */
const AuthenticationProviderSettingsSchema = z.object({
/** Whether group sync from this provider is enabled. */
groupSyncEnabled: z.boolean().optional(),
/** The claim path in the provider response that contains group data. */
groupClaim: z.string().max(255).optional(),
/** Additional scopes to request when group sync is enabled. */
groupSyncScopes: z.array(z.string().max(255)).max(20).optional(),
});
export const AuthenticationProvidersUpdateSchema = BaseSchema.extend({
body: z.object({
/** Authentication Provider Id */
id: z.uuid(),
/** Whether the Authentication Provider is enabled or not */
isEnabled: z.boolean().optional(),
/** Provider-specific settings such as group sync configuration */
settings: AuthenticationProviderSettingsSchema.optional(),
}),
});
export type AuthenticationProvidersUpdateReq = z.infer<
typeof AuthenticationProvidersUpdateSchema
>;
export const AuthenticationProvidersDeleteSchema = BaseSchema.extend({
body: z.object({
/** Authentication Provider Id */
id: z.uuid(),
}),
});
export type AuthenticationProvidersDeleteReq = z.infer<
typeof AuthenticationProvidersDeleteSchema
>;