-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(): add apis: AuthApi_checkLoginByName, AuthApi_switchOrg, Bootst…
…rapStandaloneApi_batchDeleteBootstrapStandaloneCache, CustomAuthConfigApi_createBackendNode, CustomAuthConfigApi_updateBackendNode, SsoApi_validateAccessToken, SsoServerApi_index, SsoServerApi_oauthAccessToken, SsoServerApi_oauthUserInfo INFRA-0
- Loading branch information
1 parent
3ad1103
commit ab0f39d
Showing
24 changed files
with
983 additions
and
13 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
sdk/api-gateway-sdk/src/api/api_gateway/auth/checkLoginByName.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { http, HttpOptions } from "@next-core/http"; | ||
import { ResponseBodyWrapper } from "../../../wrapper.js"; | ||
|
||
export interface AuthApi_CheckLoginByNameRequestBody { | ||
/** 用户名 */ | ||
username?: string; | ||
|
||
/** 客户id */ | ||
org?: number; | ||
} | ||
|
||
export interface AuthApi_CheckLoginByNameResponseBody { | ||
/** 是否已经登录 */ | ||
loggedIn?: boolean; | ||
|
||
/** 用户名 */ | ||
username?: string; | ||
|
||
/** 客户id */ | ||
org?: number; | ||
|
||
/** 登录Session */ | ||
loginSession?: string; | ||
} | ||
|
||
/** | ||
* @description 判断用户是否登录 | ||
* @endpoint POST /api/auth/user/check/login | ||
*/ | ||
export const AuthApi_checkLoginByName = async ( | ||
data: AuthApi_CheckLoginByNameRequestBody, | ||
options?: HttpOptions | ||
): Promise<AuthApi_CheckLoginByNameResponseBody> => | ||
/**! @contract easyops.api.api_gateway.auth.CheckLoginByName@1.2.0 */ ( | ||
await http.post<ResponseBodyWrapper<AuthApi_CheckLoginByNameResponseBody>>( | ||
"api/auth/user/check/login", | ||
data, | ||
options | ||
) | ||
).data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
export * from "./checkLogin.js"; | ||
export * from "./checkLoginByName.js"; | ||
export * from "./getCaptcha.js"; | ||
export * from "./ldapLogin.js"; | ||
export * from "./loginV2.js"; | ||
export * from "./logout.js"; | ||
export * from "./refreshToken.js"; | ||
export * from "./register.js"; | ||
export * from "./registerV2.js"; | ||
export * from "./switchOrg.js"; | ||
export * from "./tokenLdapLogin.js"; | ||
export * from "./tokenLogin.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { http, HttpOptions } from "@next-core/http"; | ||
import { ResponseBodyWrapper } from "../../../wrapper.js"; | ||
|
||
export interface AuthApi_SwitchOrgRequestBody { | ||
/** 切换到哪个组织 (具体是哪个用户切换组织,从 context 中获取 username) */ | ||
org: number; | ||
} | ||
|
||
export interface AuthApi_SwitchOrgResponseBody { | ||
/** 用户名 */ | ||
username?: string; | ||
|
||
/** 组织 org */ | ||
org?: number; | ||
|
||
/** 用户 id */ | ||
userInstanceId?: string; | ||
|
||
/** 判断当前登录用户是否是系统管理员 */ | ||
isAdmin?: boolean; | ||
|
||
/** 主名称 次名称 */ | ||
userShowValue?: string[]; | ||
} | ||
|
||
/** | ||
* @description 多组织用户切换组织 | ||
* @endpoint POST /api/auth/login/switch_org | ||
*/ | ||
export const AuthApi_switchOrg = async ( | ||
data: AuthApi_SwitchOrgRequestBody, | ||
options?: HttpOptions | ||
): Promise<AuthApi_SwitchOrgResponseBody> => | ||
/**! @contract easyops.api.api_gateway.auth.SwitchOrg@1.0.0 */ ( | ||
await http.post<ResponseBodyWrapper<AuthApi_SwitchOrgResponseBody>>( | ||
"api/auth/login/switch_org", | ||
data, | ||
options | ||
) | ||
).data; |
20 changes: 20 additions & 0 deletions
20
...teway-sdk/src/api/api_gateway/bootstrap_standalone/batchDeleteBootstrapStandaloneCache.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { http, HttpOptions } from "@next-core/http"; | ||
|
||
export interface BootstrapStandaloneApi_BatchDeleteBootstrapStandaloneCacheRequestBody { | ||
/** 主页 */ | ||
homePage?: string[]; | ||
} | ||
|
||
/** | ||
* @description 批量删除独立小产品主页缓存 | ||
* @endpoint POST /api/v1/bootstrap_standalone_cache/batch_delete | ||
*/ | ||
export const BootstrapStandaloneApi_batchDeleteBootstrapStandaloneCache = ( | ||
data: BootstrapStandaloneApi_BatchDeleteBootstrapStandaloneCacheRequestBody, | ||
options?: HttpOptions | ||
): Promise<void> => | ||
/**! @contract easyops.api.api_gateway.bootstrap_standalone.BatchDeleteBootstrapStandaloneCache@1.0.0 */ http.post<void>( | ||
"api/v1/bootstrap_standalone_cache/batch_delete", | ||
data, | ||
options | ||
); |
1 change: 1 addition & 0 deletions
1
sdk/api-gateway-sdk/src/api/api_gateway/bootstrap_standalone/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
sdk/api-gateway-sdk/src/api/api_gateway/custom_auth_config/createBackendNode.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { http, HttpOptions } from "@next-core/http"; | ||
import { ModelBackendNode } from "../../../model/api_gateway/index.js"; | ||
import { ResponseBodyWrapper } from "../../../wrapper.js"; | ||
|
||
export interface CustomAuthConfigApi_CreateBackendNodeRequestBody { | ||
/** 节点 */ | ||
node?: Partial<ModelBackendNode>; | ||
|
||
/** 关联的服务ID列表 */ | ||
serviceInstanceIds?: string[]; | ||
} | ||
|
||
export interface CustomAuthConfigApi_CreateBackendNodeResponseBody { | ||
/** 节点id */ | ||
id?: string; | ||
} | ||
|
||
/** | ||
* @description 创建后端节点 | ||
* @endpoint POST /api/v1/api_gateway/backend_node | ||
*/ | ||
export const CustomAuthConfigApi_createBackendNode = async ( | ||
data: CustomAuthConfigApi_CreateBackendNodeRequestBody, | ||
options?: HttpOptions | ||
): Promise<CustomAuthConfigApi_CreateBackendNodeResponseBody> => | ||
/**! @contract easyops.api.api_gateway.custom_auth_config.CreateBackendNode@1.4.0 */ ( | ||
await http.post< | ||
ResponseBodyWrapper<CustomAuthConfigApi_CreateBackendNodeResponseBody> | ||
>("api/v1/api_gateway/backend_node", data, options) | ||
).data; |
2 changes: 2 additions & 0 deletions
2
sdk/api-gateway-sdk/src/api/api_gateway/custom_auth_config/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
export * from "./createBackendNode.js"; | ||
export * from "./createCustomAuthConfig.js"; | ||
export * from "./deleteCustomAuthConfig.js"; | ||
export * from "./getCustomAuthConfig.js"; | ||
export * from "./listCustomAuthConfig.js"; | ||
export * from "./oAuth2AccessTokenDebug.js"; | ||
export * from "./updateCustomAuthConfig.js"; | ||
export * from "./updateBackendNode.js"; |
38 changes: 38 additions & 0 deletions
38
sdk/api-gateway-sdk/src/api/api_gateway/custom_auth_config/updateBackendNode.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { http, HttpOptions } from "@next-core/http"; | ||
import { ModelBackendNode } from "../../../model/api_gateway/index.js"; | ||
import { ResponseBodyWrapper } from "../../../wrapper.js"; | ||
|
||
export interface CustomAuthConfigApi_UpdateBackendNodeRequestBody { | ||
/** 节点 */ | ||
node?: Partial<ModelBackendNode>; | ||
|
||
/** 解绑或者绑定服务 */ | ||
serviceOperation?: CustomAuthConfigApi_UpdateBackendNodeRequestBody_serviceOperation_item[]; | ||
} | ||
|
||
export interface CustomAuthConfigApi_UpdateBackendNodeResponseBody { | ||
/** 节点id */ | ||
id?: string; | ||
} | ||
|
||
/** | ||
* @description 更新后端节点 | ||
* @endpoint PUT /api/v1/api_gateway/backend_node | ||
*/ | ||
export const CustomAuthConfigApi_updateBackendNode = async ( | ||
data: CustomAuthConfigApi_UpdateBackendNodeRequestBody, | ||
options?: HttpOptions | ||
): Promise<CustomAuthConfigApi_UpdateBackendNodeResponseBody> => | ||
/**! @contract easyops.api.api_gateway.custom_auth_config.UpdateBackendNode@1.4.0 */ ( | ||
await http.put< | ||
ResponseBodyWrapper<CustomAuthConfigApi_UpdateBackendNodeResponseBody> | ||
>("api/v1/api_gateway/backend_node", data, options) | ||
).data; | ||
|
||
export interface CustomAuthConfigApi_UpdateBackendNodeRequestBody_serviceOperation_item { | ||
/** 绑定/解绑 */ | ||
operate?: "append" | "remove"; | ||
|
||
/** 服务实例id */ | ||
instanceId?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
sdk/api-gateway-sdk/src/api/api_gateway/sso/ssoAuthorizeRedirect.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import { http, HttpOptions } from "@next-core/http"; | ||
|
||
/** 认证参数 */ | ||
export type SsoApi_SsoAuthorizeRedirectRequestBody = any; | ||
|
||
/** | ||
* @description SSO访问令牌认证; SSO身份认证成功后认证服务将会携带 登录凭证 重定向至该接口 (该接口最后会直接重定向到easyops平台的/next/sso-auth/authorize页面,可以是GET请求也可以是POST请求) | ||
* @endpoint POST /api/v2/sso/authorization | ||
* @endpoint POST /api/v2/sso/authorization/:protocol | ||
*/ | ||
export const SsoApi_ssoAuthorizeRedirect = ( | ||
protocol: string | number, | ||
data: SsoApi_SsoAuthorizeRedirectRequestBody, | ||
options?: HttpOptions | ||
): Promise<void> => | ||
/**! @contract easyops.api.api_gateway.sso.SSOAuthorizeRedirect@1.0.0 */ http.post<void>( | ||
"api/v2/sso/authorization", | ||
/**! @contract easyops.api.api_gateway.sso.SSOAuthorizeRedirect@1.0.1 */ http.post<void>( | ||
`api/v2/sso/authorization/${protocol}`, | ||
data, | ||
options | ||
); |
29 changes: 29 additions & 0 deletions
29
sdk/api-gateway-sdk/src/api/api_gateway/sso/validateAccessToken.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { http, HttpOptions } from "@next-core/http"; | ||
import { ResponseBodyWrapper } from "../../../wrapper.js"; | ||
|
||
export interface SsoApi_ValidateAccessTokenResponseBody { | ||
/** 用户名 */ | ||
username?: string; | ||
|
||
/** 用户ID */ | ||
userId?: string; | ||
|
||
/** access token过期时长 */ | ||
expired?: number; | ||
|
||
/** 昵称 */ | ||
nickname?: string; | ||
} | ||
|
||
/** | ||
* @description 云盾平台子系统校验access token, 使用HEADER携带AccessToken | ||
* @endpoint POST /api/v1/sso/auth/token/validate | ||
*/ | ||
export const SsoApi_validateAccessToken = async ( | ||
options?: HttpOptions | ||
): Promise<SsoApi_ValidateAccessTokenResponseBody> => | ||
/**! @contract easyops.api.api_gateway.sso.ValidateAccessToken@1.0.0 */ ( | ||
await http.post< | ||
ResponseBodyWrapper<SsoApi_ValidateAccessTokenResponseBody> | ||
>("api/v1/sso/auth/token/validate", undefined, options) | ||
).data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./oauthAccessToken.js"; | ||
export * from "./oauthUserInfo.js"; |
49 changes: 49 additions & 0 deletions
49
sdk/api-gateway-sdk/src/api/api_gateway/sso_server/oauthAccessToken.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { http, HttpOptions } from "@next-core/http"; | ||
|
||
export interface SsoServerApi_OauthAccessTokenRequestBody { | ||
/** clientId */ | ||
client_id: string; | ||
|
||
/** 可信任的密钥凭证 */ | ||
client_secret?: string; | ||
|
||
/** 重定向uri */ | ||
redirect_uri: string; | ||
|
||
/** 授权码,这里传拿到的授权码 */ | ||
code: string; | ||
|
||
/** 授权类型,这里是使用授权码,传authorization_code */ | ||
grant_type: string; | ||
} | ||
|
||
export interface SsoServerApi_OauthAccessTokenResponseBody { | ||
/** 生成的accessToken */ | ||
access_token?: string; | ||
|
||
/** 超时时间,单位秒 */ | ||
expires_in?: number; | ||
|
||
/** 访问令牌的类型,通常值为 "Bearer" */ | ||
token_type?: string; | ||
|
||
/** 表示访问令牌的范围 */ | ||
scope?: string; | ||
|
||
/** refresh_token,这里先声明这个字段,暂不生成 */ | ||
refresh_token?: string; | ||
} | ||
|
||
/** | ||
* @description oauth2授权码模式,获取accessToken接口 | ||
* @endpoint POST /api/v1/api_gateway/sso_server/oauth2/access_token | ||
*/ | ||
export const SsoServerApi_oauthAccessToken = ( | ||
data: SsoServerApi_OauthAccessTokenRequestBody, | ||
options?: HttpOptions | ||
): Promise<SsoServerApi_OauthAccessTokenResponseBody> => | ||
/**! @contract easyops.api.api_gateway.sso_server.OauthAccessToken@1.0.0 */ http.post<SsoServerApi_OauthAccessTokenResponseBody>( | ||
"api/v1/api_gateway/sso_server/oauth2/access_token", | ||
data, | ||
options | ||
); |
18 changes: 18 additions & 0 deletions
18
sdk/api-gateway-sdk/src/api/api_gateway/sso_server/oauthUserInfo.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { http, HttpOptions } from "@next-core/http"; | ||
|
||
export interface SsoServerApi_OauthUserInfoResponseBody { | ||
/** 用户信息 */ | ||
sub?: string; | ||
} | ||
|
||
/** | ||
* @description oauth2授权码模式,获取userInfo接口 | ||
* @endpoint GET /api/v1/api_gateway/sso_server/oauth2/user_info | ||
*/ | ||
export const SsoServerApi_oauthUserInfo = ( | ||
options?: HttpOptions | ||
): Promise<SsoServerApi_OauthUserInfoResponseBody> => | ||
/**! @contract easyops.api.api_gateway.sso_server.OauthUserInfo@1.0.0 */ http.get<SsoServerApi_OauthUserInfoResponseBody>( | ||
"api/v1/api_gateway/sso_server/oauth2/user_info", | ||
options | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
sdk/api-gateway-sdk/src/model/api_gateway/ModelBackendNode.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** 后端节点 */ | ||
export interface ModelBackendNode { | ||
/** 实例ID */ | ||
instanceId: string; | ||
|
||
/** ip/host */ | ||
ip: string; | ||
|
||
/** port */ | ||
port: number; | ||
|
||
/** 协议 */ | ||
scheme: "http" | "https"; | ||
|
||
/** 是否启用 */ | ||
enabled: boolean; | ||
|
||
/** 权重 */ | ||
weight: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.