mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 09:36:44 +00:00
chore(core): Synchronize OIDC settings updates in multi main (#19360)
This commit is contained in:
40
packages/@n8n/db/src/entities/__tests__/types-db.test.ts
Normal file
40
packages/@n8n/db/src/entities/__tests__/types-db.test.ts
Normal 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
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user