mirror of
https://github.com/certd/certd.git
synced 2026-04-23 19:57:27 +08:00
chore: oidc first
This commit is contained in:
@@ -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;
|
||||
}>;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user