chore: oidc first

This commit is contained in:
xiaojunnuo
2025-11-26 07:34:42 +08:00
parent b4c362da37
commit 5a148aa3b9
12 changed files with 107 additions and 1586 deletions
+1
View File
@@ -106,6 +106,7 @@
"nanoid": "^5.0.7",
"node-forge": "^1.3.1",
"nodemailer": "^6.9.16",
"openid-client": "^6.8.1",
"otplib": "^12.0.1",
"pg": "^8.12.0",
"psl": "^1.9.0",
@@ -0,0 +1,30 @@
import { BaseController, Constants } from "@certd/lib-server";
import { ALL, Body, Controller, Get, Post, Provide, Query } from "@midwayjs/core";
/**
*/
@Provide()
@Controller('/api/connect')
export class LoginController extends BaseController {
@Get('/login', { summary: Constants.per.guest })
public async login(@Query(ALL) body: any) {
//构造登录url
return this.ok(1);
}
@Get('/callback', { summary: Constants.per.guest })
public async callback(@Query(ALL) body: any) {
//处理登录回调
return this.ok(1);
}
@Post('/bind', { summary: Constants.per.guest })
public async bind(@Body(ALL) body: any) {
const autoRegister = body.autoRegister || false;
const bindInfo = body.bind || {};
//处理登录回调
return this.ok(1);
}
}
@@ -0,0 +1,24 @@
export interface OauthProvider {
buildLoginUrl: (params: { redirectUri: string }) => string;
handleCallback: (params: { code: string; redirectUri: string }) => Promise<{
accessToken: string;
refreshToken: string;
expiresIn: number;
idToken: string;
scope: string;
tokenType: string;
}>;
bind: (params: {
accessToken: string;
refreshToken: string;
expiresIn: number;
idToken: string;
scope: string;
tokenType: string;
bindInfo: any;
}) => Promise<{
success: boolean;
message: string;
}>;
}