From 24396a8782544271cbcbdeaeac9056fe56cd39bf Mon Sep 17 00:00:00 2001 From: qcqcqc <1220204124@zust.edu.cn> Date: Thu, 4 Dec 2025 11:08:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=BC=E5=87=BAoauth=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E5=A4=84=E7=90=86=E5=99=A8=E7=9A=84?= =?UTF-8?q?=E6=B3=A8=E5=85=A5=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/registry.backend.ts | 5 +++++ src/utils/oauth/index.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/registry.backend.ts b/src/registry.backend.ts index 052713dba..19d60de82 100644 --- a/src/registry.backend.ts +++ b/src/registry.backend.ts @@ -55,3 +55,8 @@ export { // 注册对象存储服务商实现(后端) registerCosBackend, } from './utils/cos/index.backend'; + +export { + // 注册OAuth用户信息获取处理器 + registerOauthUserinfoHandler, +} from './utils/oauth/index'; \ No newline at end of file diff --git a/src/utils/oauth/index.ts b/src/utils/oauth/index.ts index 4d3eabd8c..b4cd5c39a 100644 --- a/src/utils/oauth/index.ts +++ b/src/utils/oauth/index.ts @@ -17,7 +17,7 @@ export type UserInfoHandler = (data: UserInfo) => UserID | Promise const handlerMap = new Map(); -export const registerUserinfoHandler = (type: EntityDict['oauthProvider']['Schema']['type'], handler: UserInfoHandler) => { +export const registerOauthUserinfoHandler = (type: EntityDict['oauthProvider']['Schema']['type'], handler: UserInfoHandler) => { if (handlerMap.has(type)) { throw new Error(`oauth provider type ${type} 的 userinfo 处理器已注册`); } @@ -35,7 +35,7 @@ export const processUserInfo = (type: EntityDict['oauthProvider']['Schema']['typ const defaulthandlers = getDefaultHandlers(); Object.entries(defaulthandlers).forEach(([type, handler]) => { - registerUserinfoHandler(type as EntityDict['oauthProvider']['Schema']['type'], handler); + registerOauthUserinfoHandler(type as EntityDict['oauthProvider']['Schema']['type'], handler); });