feat: 导出oauth用户信息处理器的注入点
This commit is contained in:
parent
5af3a8f9db
commit
24396a8782
|
|
@ -55,3 +55,8 @@ export {
|
|||
// 注册对象存储服务商实现(后端)
|
||||
registerCosBackend,
|
||||
} from './utils/cos/index.backend';
|
||||
|
||||
export {
|
||||
// 注册OAuth用户信息获取处理器
|
||||
registerOauthUserinfoHandler,
|
||||
} from './utils/oauth/index';
|
||||
|
|
@ -17,7 +17,7 @@ export type UserInfoHandler = (data: UserInfo) => UserID | Promise<UserID>
|
|||
|
||||
const handlerMap = new Map<EntityDict['oauthProvider']['Schema']['type'], UserInfoHandler>();
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue