UNPKG

@sasjs/adapter

Version:

JavaScript adapter for SAS

50 lines (49 loc) 1.8 kB
import { ServerType } from '@sasjs/utils/types'; import { RequestClient } from '../request/RequestClient'; import { LoginOptions, LoginResult, LoginResultInternal } from '../types/Login'; export declare class AuthManager { private serverUrl; private serverType; private requestClient; private loginCallback; userName: string; userLongName: string; private loginUrl; private logoutUrl; private redirectedLoginUrl; constructor(serverUrl: string, serverType: ServerType, requestClient: RequestClient, loginCallback: () => Promise<void>); /** * Opens Pop up window to SAS Login screen. * And checks if user has finished login process. */ redirectedLogIn({ onLoggedOut }: LoginOptions): Promise<LoginResult>; /** * Logs into the SAS server with the supplied credentials. * @param username - a string representing the username. * @param password - a string representing the password. * @returns - a boolean `isLoggedin` and a string `username` */ logIn(username: string, password: string): Promise<LoginResult>; private performCASSecurityCheck; private sendLoginRequest; /** * Checks whether a session is active, or login is required. * @returns - a promise which resolves with an object containing three values * - a boolean `isLoggedIn` * - a string `userName`, * - a string `userFullName` and * - a form `loginForm` if not loggedIn. */ checkSession(): Promise<LoginResultInternal>; private getNewLoginForm; private fetchUserName; private extractUserName; private extractUserLongName; private getLoginForm; private setLoginUrl; /** * Logs out of the configured SAS server. * */ logOut(): Promise<boolean>; }