UNPKG

graphdb-workbench

Version:
71 lines (70 loc) 3.29 kB
import { HttpService } from '../http/http.service'; import { AuthenticatedUser, AuthSettingsResponseModel, SecurityConfig } from '../../models/security'; import { AuthSettingsRequestModel } from '../../models/security/response-models/auth-settings-request-model'; import { AuthenticatedUserResponse } from '../../models/security/response-models/authenticated-user-response'; import { HttpResponse } from '../../models/http'; /** * Service class for handling security-related REST operations. */ export declare class SecurityRestService extends HttpService { private readonly SECURITY_ENDPOINT; private readonly LOGIN_ENDPOINT; private readonly SECURITY_USER_ENDPOINT; private readonly SECURITY_FREE_ACCESS_ENDPOINT; /** * Authenticates a user by sending credentials to the server. * * Sends a POST request to the login endpoint with the provided username and password. * * @param username - The user's login name. * @param password - The user's password. * @returns A Promise resolving to an HttpResponse containing the AuthenticatedUser data on success. */ loginGdbToken(username: string, password: string): Promise<HttpResponse<AuthenticatedUserResponse>>; /** * Retrieves the full security configuration from the backend. * * Sends a GET request to fetch the application's security-related configuration, including roles, permissions, * and OpenID settings. * * @returns A Promise that resolves with the SecurityConfig object. */ getSecurityConfig(): Promise<SecurityConfig>; /** * Retrieves information about the currently authenticated user. * * Sends a GET request to the security endpoint to fetch details about the user * who is currently authenticated in the system. * * @returns A Promise that resolves with the AuthenticatedUser object containing * the user's details such as username, roles, and application settings. */ getAuthenticatedUser(): Promise<AuthenticatedUserResponse>; /** * Retrieves information about the admin user. * * Sends a GET request to fetch details about the admin user in the system. * * @returns A Promise that resolves with the AuthenticatedUser object containing * the admin user's details such as username, roles, and application settings. */ getAdminUser(): Promise<AuthenticatedUser>; /** * Retrieves the free access settings from the backend. * * Sends a GET request to fetch the configuration related to free access mode. * * @returns A Promise that resolves with the AuthSettingsResponseModel containing * the free access settings. */ getFreeAccess(): Promise<AuthSettingsResponseModel>; /** * Sets the free access configuration in the backend. * * Sends a POST request to update the free access settings with the provided data. * * @param freeAccessData - An AuthSettingsRequestModel object containing the new free access settings. * @returns A Promise that resolves with the AuthSettingsResponseModel after updating the settings. */ setFreeAccess(freeAccessData: AuthSettingsRequestModel): Promise<AuthSettingsResponseModel>; }