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); });