backend: enforce required oauthProviders in AuthenticationConfig and update related schemas

This commit is contained in:
juancarmore 2026-01-21 19:34:10 +01:00
parent c0ecc826cb
commit 8d255bd051
4 changed files with 15 additions and 6 deletions

View File

@ -49,7 +49,7 @@ const AuthenticationConfigSchema = new Schema(
},
oauthProviders: {
type: [OAuthProviderConfigSchema],
required: false
required: true
}
},
{ _id: false }

View File

@ -1,4 +1,4 @@
import { AuthenticationConfig, SecurityConfig, WebhookConfig } from '@openvidu-meet/typings';
import { AuthenticationConfig, OAuthProvider, SecurityConfig, WebhookConfig } from '@openvidu-meet/typings';
import { z } from 'zod';
import { AppearanceConfigSchema } from './room.schema.js';
@ -29,8 +29,16 @@ export const TestWebhookReqSchema = z.object({
.regex(/^https?:\/\//, { message: 'URL must start with http:// or https://' })
});
const OAuthProviderConfigSchema = z.object({
provider: z.nativeEnum(OAuthProvider),
clientId: z.string(),
clientSecret: z.string(),
redirectUri: z.string()
});
const AuthenticationConfigSchema: z.ZodType<AuthenticationConfig> = z.object({
allowUserCreation: z.boolean()
allowUserCreation: z.boolean(),
oauthProviders: z.array(OAuthProviderConfigSchema)
});
export const SecurityConfigSchema: z.ZodType<SecurityConfig> = z.object({

View File

@ -207,7 +207,8 @@ export class GlobalConfigService {
},
securityConfig: {
authentication: {
allowUserCreation: true
allowUserCreation: true,
oauthProviders: []
}
},
roomsConfig: {

View File

@ -8,9 +8,9 @@ export interface AuthenticationConfig {
allowUserCreation: boolean;
/**
* Optional list of allowed OAuth providers for user registration.
* List of allowed OAuth providers for user registration.
*/
oauthProviders?: OAuthProviderConfig[];
oauthProviders: OAuthProviderConfig[];
}
/**