feat:增加 oauth2.0 授权
This commit is contained in:
53
apps/web-antd/src/api/system/oauth2/client/index.ts
Normal file
53
apps/web-antd/src/api/system/oauth2/client/index.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
export namespace SystemOAuth2ClientApi {
|
||||
/** OAuth2.0 客户端信息 */
|
||||
export interface SystemOAuth2Client {
|
||||
id?: number;
|
||||
clientId: string;
|
||||
secret: string;
|
||||
name: string;
|
||||
logo: string;
|
||||
description: string;
|
||||
status: number;
|
||||
accessTokenValiditySeconds: number;
|
||||
refreshTokenValiditySeconds: number;
|
||||
redirectUris: string[];
|
||||
autoApprove: boolean;
|
||||
authorizedGrantTypes: string[];
|
||||
scopes: string[];
|
||||
authorities: string[];
|
||||
resourceIds: string[];
|
||||
additionalInformation: string;
|
||||
isAdditionalInformationJson: boolean;
|
||||
createTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询 OAuth2.0 客户端列表 */
|
||||
export function getOAuth2ClientPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<SystemOAuth2ClientApi.SystemOAuth2Client>>('/system/oauth2-client/page',
|
||||
{ params }
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询 OAuth2.0 客户端详情 */
|
||||
export function getOAuth2Client(id: number) {
|
||||
return requestClient.get<SystemOAuth2ClientApi.SystemOAuth2Client>(`/system/oauth2-client/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增 OAuth2.0 客户端 */
|
||||
export function createOAuth2Client(data: SystemOAuth2ClientApi.SystemOAuth2Client) {
|
||||
return requestClient.post('/system/oauth2-client/create', data);
|
||||
}
|
||||
|
||||
/** 修改 OAuth2.0 客户端 */
|
||||
export function updateOAuth2Client(data: SystemOAuth2ClientApi.SystemOAuth2Client) {
|
||||
return requestClient.put('/system/oauth2-client/update', data);
|
||||
}
|
||||
|
||||
/** 删除 OAuth2.0 客户端 */
|
||||
export function deleteOAuth2Client(id: number) {
|
||||
return requestClient.delete(`/system/oauth2-client/delete?id=${id}`);
|
||||
}
|
||||
28
apps/web-antd/src/api/system/oauth2/token/index.ts
Normal file
28
apps/web-antd/src/api/system/oauth2/token/index.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
export namespace SystemOAuth2TokenApi {
|
||||
/** OAuth2.0 令牌信息 */
|
||||
export interface SystemOAuth2Token {
|
||||
id?: number;
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
userId: number;
|
||||
userType: number;
|
||||
clientId: string;
|
||||
createTime?: Date;
|
||||
expiresTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询 OAuth2.0 令牌列表 */
|
||||
export function getOAuth2TokenPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<SystemOAuth2TokenApi.SystemOAuth2Token>>('/system/oauth2-token/page', {
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除 OAuth2.0 令牌 */
|
||||
export function deleteOAuth2Token(accessToken: string) {
|
||||
return requestClient.delete(`/system/oauth2-token/delete?accessToken=${accessToken}`);
|
||||
}
|
||||
Reference in New Issue
Block a user