Files
outline/server/routes/api/authenticationProviders/schema.ts
T
Tom MoorandClaude Fable 5.1 abc47b442a feat: Sync group descriptions and re-sync groups on SSO validation (#13889)
* feat: Sync group descriptions and re-sync groups on SSO validation

- Sync group descriptions from group sync providers alongside names
- Lock name and description edits for externally synced groups at the
  API layer and in the edit dialog
- Move group sync into a SyncUserGroupsTask, scheduled from login and
  from ValidateSSOAccessTask after a fresh provider validation
- Add authenticationProviders.startGroupSync for providers that require
  an admin consent flow before group sync can be enabled

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix: Make group sync setup generic and deduplicate sync jobs

- Expose groupSyncRequiresSetup from the provider list and use it in the
  settings scene instead of checking for the azure provider name
- Rename the setup redirect query param to groupSync
- Give SyncUserGroupsTask a job id per user authentication so concurrent
  syncs for the same authentication are not queued twice

* Use existing hook

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-25 19:49:26 -04:00

60 lines
1.8 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 AuthenticationProvidersStartGroupSyncSchema = BaseSchema.extend({
body: z.object({ id: z.uuid() }),
});
export type AuthenticationProvidersStartGroupSyncReq = z.infer<
typeof AuthenticationProvidersStartGroupSyncSchema
>;
export const AuthenticationProvidersDeleteSchema = BaseSchema.extend({
body: z.object({
/** Authentication Provider Id */
id: z.uuid(),
}),
});
export type AuthenticationProvidersDeleteReq = z.infer<
typeof AuthenticationProvidersDeleteSchema
>;