This commit is contained in:
Windfarer
2026-03-30 11:13:44 +08:00
parent 72dfb9ce75
commit c1816fe6d6
54 changed files with 3412 additions and 807 deletions
+45
View File
@@ -39,6 +39,20 @@ export interface LoginResponse {
refresh_token?: string
}
export interface OIDCAuthURLResponse {
success: boolean
authorization_url?: string
state?: string
message?: string
}
export interface OIDCConfigResponse {
success: boolean
enabled: boolean
provider_display_name?: string
message?: string
}
// 用户注册接口
export interface RegisterRequest {
username: string
@@ -130,6 +144,37 @@ export async function login(data: LoginRequest): Promise<LoginResponse> {
}
}
/**
* 获取 OIDC 登录跳转地址
*/
export async function getOIDCAuthorizationURL(redirectURI: string): Promise<OIDCAuthURLResponse> {
try {
const response = await get(`/api/v1/auth/oidc/url?redirect_uri=${encodeURIComponent(redirectURI)}`)
return response as unknown as OIDCAuthURLResponse
} catch (error: any) {
return {
success: false,
message: error.message || t('error.auth.loginFailed')
}
}
}
/**
* 获取 OIDC 登录配置
*/
export async function getOIDCConfig(): Promise<OIDCConfigResponse> {
try {
const response = await get('/api/v1/auth/oidc/config')
return response as unknown as OIDCConfigResponse
} catch (error: any) {
return {
success: false,
enabled: false,
message: error.message || t('error.auth.loginFailed')
}
}
}
/**
* 用户注册
*/