🔨 chore: add OAuth 2.0 and OIDC core implement (#7380)

* add oidc implement

* add oidc implement

* update

* update

* migration db

* improve

* improve scripts

* update

* 解决 auth 302 跳转的问题

* 完成 policy 实现调试

* improve middleware log

* 初步完成 auth 授权实现

* 初步完成 auth 授权实现

* fix adapter

* add adapter tests

* refactor with http adapter

* refactor for oidc service

* finish oauth 授权基础实现

* 区分 backend 入口与 client 页面入口

* add i18n

* update db schema

* fix lint

* improve

* fix tests and update i18n

* improve db adaptor

* fix tests

* fix tests

* fix tests
This commit is contained in:
Arvin Xu
2025-04-13 00:49:31 +08:00
committed by GitHub
parent 3014dfcc16
commit b12b24018e
66 changed files with 8835 additions and 20 deletions

View File

@@ -3,7 +3,6 @@ import { migrate as neonMigrate } from 'drizzle-orm/neon-serverless/migrator';
import { migrate as nodeMigrate } from 'drizzle-orm/node-postgres/migrator';
import { join } from 'node:path';
import { serverDB } from '../../src/database/server';
import { DB_FAIL_INIT_HINT, PGVECTOR_HINT } from './errorHint';
// Read the `.env` file if it exists, or a file specified by the
@@ -13,7 +12,10 @@ dotenv.config();
const migrationsFolder = join(__dirname, '../../src/database/migrations');
const isDesktop = process.env.NEXT_PUBLIC_IS_DESKTOP_APP === '1';
const runMigrations = async () => {
const { serverDB } = await import('../../src/database/server');
if (process.env.DATABASE_DRIVER === 'node') {
await nodeMigrate(serverDB, { migrationsFolder });
} else {