import { User, UserState } from 'gmfapi/store/user'; import { gmfAuthenticationNoReloadRole as gmfOptionsGmfAuthenticationNoReloadRole } from 'gmfapi/store/config'; type AuthenticationDefaultResponse = { success: boolean; }; declare let userTransformer: (user: User) => User; /** * Method defined in the aim to be overridden. * @param fn The callback function to apply after login. */ export declare function setOnSuccessfulLoginFunction(fn: typeof userTransformer): void; export declare enum RouteSuffix { CHANGE_PASSWORD = "loginchangepassword", IS_LOGGED_IN = "loginuser", LOGIN = "login", LOGOUT = "logout", RESET_PASSWORD = "loginresetpassword" } /** * An "authentication" service for a GeoMapFish application. Upon loading, it * launches a request to determine whether a user is currently logged in or * not. * * The possible API requests it supports, which are all self-explanatory, are: * * - changePassword * - login * - logout * - resetPassword */ export declare class AuthenticationService { /** * The authentication url without trailing slash. * @private */ baseUrl_: string; /** * The user. * @private */ user_: User; /** * Don't request a new user object from the back-end after * logging out if the logged-in user's role has this role. * @private */ noReloadRole_: undefined | gmfOptionsGmfAuthenticationNoReloadRole; verifyConnection_: number; originalUrl: string; constructor(); /** * Check whether the user is connected or not like on load. * @private */ checkConnection_(): void; handleDisconnection(): void; /** * Load the authentication service, which sends an async request to * determine whether the user is currently connected or not. * @private */ load_(): void; /** * @param login Login. * @param oldPwd Old password. * @param newPwd New password. * @param confPwd New password confirmation. * @param {string} [otp] One-time password. * @returns Promise. */ changePassword(login: string, oldPwd: string, newPwd: string, confPwd: string, otp?: string): Promise; /** * @param login Login name. * @param pwd Password. * @param {string} [otp] One-time password. * @returns Promise. */ login(login: string, pwd: string, otp?: string): Promise; /** * Check the user to have a user with all parameters in all cases. * @param data Ajax response. * @returns Response. */ checkUser_(data: User): User; /** * @returns Promise. */ logout(): Promise; /** * @param login Login name. * @returns Promise. */ resetPassword(login: string): Promise; /** * @returns Username */ getUsername(): string | null; /** * @returns User's email */ getEmail(): string | null; /** * @returns The roles IDs. */ getRolesIds(): number[]; /** * @returns The roles names. */ getRolesNames(): string[]; /** * @param checkingLoginStatus Checking the login status? * @param data Ajax response. * @returns Response. * @private */ handleLogin_(checkingLoginStatus: boolean, data: User): User; /** * @param respData Response. * @param userState state of the user. * @private */ setUser_(respData: User, userState: UserState): void; /** * @param userState state of the user. * @param noReload Don't request a new user object from * the back-end after logging out, defaults to false. */ resetUser(userState: UserState, noReload: boolean): void; } declare const ngeoAuthService: AuthenticationService; export default ngeoAuthService;