chore(core): Synchronize OIDC settings updates in multi main (#19360)

This commit is contained in:
Andreas Fitzek
2025-09-15 12:42:11 +02:00
committed by GitHub
parent eab99bf87e
commit 82184c770e
13 changed files with 549 additions and 30 deletions

View File

@@ -0,0 +1,40 @@
import { isAuthProviderType } from '../types-db';
describe('types-db', () => {
describe('isAuthProviderType', () => {
it.each(['ldap', 'email', 'saml', 'oidc'])(
'should return true for valid "%s" auth provider types',
(provider) => {
expect(isAuthProviderType(provider)).toBe(true);
},
);
it.each([
'google',
'facebook',
'github',
'oauth2',
'jwt',
'basic',
'',
'LDAP', // case sensitive
'OIDC',
'Email',
])('should return false for invalid "%s" auth provider types', (provider) => {
expect(isAuthProviderType(provider)).toBe(false);
});
it.each([null, undefined, 123, true, false, {}, [], { type: 'oidc' }])(
'should return false for non-string value "%s"',
(value) => {
expect(isAuthProviderType(value as string)).toBe(false);
},
);
it('should handle edge cases', () => {
expect(isAuthProviderType(' oidc ')).toBe(false); // whitespace
expect(isAuthProviderType('oidc\n')).toBe(false); // newline
expect(isAuthProviderType('oidc\t')).toBe(false); // tab
});
});
});

View File

@@ -13,6 +13,7 @@ import type {
ExecutionSummary,
IUser,
} from 'n8n-workflow';
import { z } from 'zod';
import type { CredentialsEntity } from './credentials-entity';
import type { Folder } from './folder';
@@ -272,7 +273,13 @@ export const enum StatisticsNames {
dataLoaded = 'data_loaded',
}
export type AuthProviderType = 'ldap' | 'email' | 'saml' | 'oidc'; // | 'google';
const ALL_AUTH_PROVIDERS = z.enum(['ldap', 'email', 'saml', 'oidc']);
export type AuthProviderType = z.infer<typeof ALL_AUTH_PROVIDERS>;
export function isAuthProviderType(value: string): value is AuthProviderType {
return ALL_AUTH_PROVIDERS.safeParse(value).success;
}
export type FolderWithWorkflowAndSubFolderCount = Folder & {
workflowCount?: boolean;

View File

@@ -16,6 +16,7 @@ export type PubSubEventName =
| 'get-worker-status'
| 'reload-external-secrets-providers'
| 'reload-license'
| 'reload-oidc-config'
| 'response-to-get-worker-status'
| 'restart-event-bus'
| 'relay-execution-lifecycle-event';