backend: enforce required oauthProviders in AuthenticationConfig and update related schemas
This commit is contained in:
parent
c0ecc826cb
commit
8d255bd051
@ -49,7 +49,7 @@ const AuthenticationConfigSchema = new Schema(
|
||||
},
|
||||
oauthProviders: {
|
||||
type: [OAuthProviderConfigSchema],
|
||||
required: false
|
||||
required: true
|
||||
}
|
||||
},
|
||||
{ _id: false }
|
||||
|
||||
@ -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({
|
||||
|
||||
@ -207,7 +207,8 @@ export class GlobalConfigService {
|
||||
},
|
||||
securityConfig: {
|
||||
authentication: {
|
||||
allowUserCreation: true
|
||||
allowUserCreation: true,
|
||||
oauthProviders: []
|
||||
}
|
||||
},
|
||||
roomsConfig: {
|
||||
|
||||
@ -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[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user