mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 02:09:06 +00:00
feat(web): add OIDC SSO login support (#1943)
This commit is contained in:
@@ -6,6 +6,10 @@ export interface ValidateConfigResponse {
|
||||
toml_config: string;
|
||||
}
|
||||
|
||||
export interface OidcConfigResponse {
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
// 定义接口返回的数据结构
|
||||
export interface LoginResponse {
|
||||
success: boolean;
|
||||
@@ -174,6 +178,19 @@ export class ApiClient {
|
||||
return this.client.defaults.baseURL + '/auth/captcha';
|
||||
}
|
||||
|
||||
public async getOidcConfig(): Promise<OidcConfigResponse> {
|
||||
try {
|
||||
const response = await this.client.get<any, OidcConfigResponse>('/auth/oidc/config');
|
||||
return response;
|
||||
} catch (error) {
|
||||
return { enabled: false };
|
||||
}
|
||||
}
|
||||
|
||||
public oidcLoginUrl() {
|
||||
return this.client.defaults.baseURL + '/auth/oidc/login';
|
||||
}
|
||||
|
||||
public get_remote_client(machine_id: string): Api.RemoteClient {
|
||||
return new WebRemoteClient(machine_id, this.client);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user