feat: allow local auth provider

This commit is contained in:
thibaud-leclere 2026-05-06 08:21:24 +02:00
parent 7b4cfb4103
commit c8b7a172a4
4 changed files with 29 additions and 0 deletions

View file

@ -27,6 +27,7 @@ export enum AuthProvider {
GITHUB = 'GITHUB',
MICROSOFT = 'MICROSOFT',
EMAIL = 'EMAIL',
LOCAL = 'LOCAL',
}
/**

View file

@ -66,6 +66,7 @@ export function getAuthProviderRequiredKeys(
InfraConfigEnum.MICROSOFT_SCOPE,
InfraConfigEnum.MICROSOFT_TENANT,
],
[AuthProvider.LOCAL]: [],
[AuthProvider.EMAIL]:
env['INFRA'].MAILER_USE_CUSTOM_CONFIGS === 'true'
? [

View file

@ -16,6 +16,7 @@ import { PubSubService } from 'src/pubsub/pubsub.service';
import { ServiceStatus } from './helper';
import * as E from 'fp-ts/Either';
import { UserService } from 'src/user/user.service';
import { AuthProvider } from 'src/auth/helper';
const mockPrisma = mockDeep<PrismaService>();
const mockConfigService = mockDeep<ConfigService>();
@ -295,6 +296,19 @@ describe('InfraConfigService', () => {
});
describe('validateEnvValues', () => {
describe('VITE_ALLOWED_AUTH_PROVIDERS', () => {
it('should accept LOCAL in VITE_ALLOWED_AUTH_PROVIDERS', () => {
const result = infraConfigService.validateEnvValues([
{
name: InfraConfigEnum.VITE_ALLOWED_AUTH_PROVIDERS,
value: 'LOCAL',
},
]);
expect(result).toEqualRight(true);
});
});
describe('MAILER_SMTP_AUTH_TYPE', () => {
it('should accept an empty value (defaults to login at runtime)', () => {
const result = infraConfigService.validateEnvValues([
@ -348,6 +362,17 @@ describe('InfraConfigService', () => {
});
});
describe('isServiceConfigured', () => {
it('should consider LOCAL configured without external config', () => {
const result = infraConfigService.isServiceConfigured(
AuthProvider.LOCAL,
{},
);
expect(result).toBe(true);
});
});
describe('getOnboardingConfig', () => {
const RECOVERY_TOKEN = 'valid-recovery-token-123';

View file

@ -321,6 +321,8 @@ export class InfraConfigService implements OnModuleInit, OnModuleDestroy {
} else {
return configMap.MAILER_SMTP_URL && configMap.MAILER_ADDRESS_FROM;
}
case AuthProvider.LOCAL:
return true;
default:
return false;
}