UNPKG

@universis/common

Version:

Universis - common directives and services

53 lines (52 loc) 2.05 kB
import { AngularDataContext } from '@themost/angular'; import { ConfigurationService } from '../../shared/services/configuration.service'; import { ActivatedRoute } from '@angular/router'; import { ActivatedUser } from './activated-user.service'; import * as i0 from "@angular/core"; export interface AuthCallbackResponse { access_token: string; expires_in: number; refresh_token?: string; refresh_expires_in?: number; token_type: string; scope: string; } export interface OnRefreshToken { refresh(): Promise<AuthCallbackResponse | void>; } export declare class AuthenticationService { protected configuration: ConfigurationService; protected context: AngularDataContext; protected activatedRoute: ActivatedRoute; protected activatedUser: ActivatedUser; constructor(configuration: ConfigurationService, context: AngularDataContext, activatedRoute: ActivatedRoute, activatedUser: ActivatedUser); /** * Generates an OAuth2 state param based on the given string. * @param {string} value * @returns {string} */ protected generateState(value: string): string; /** * Gets an OAuth2 code_verifier * @returns {string} */ protected getCodeVerifier(): string; /** * Redirects user to OAuth2 server authorization URL. This operation initializes an implicit authorization flow. */ authorize(): void; protected preCallback(queryParams: any): void; /** * Handles OAuth2 server callback of an implicit authorization flow. * @param {*} queryParams * @returns {Promise<*>} - Returns an object which represents the authorized user. */ callback(queryParams: any): Promise<any>; /** * Performs user logout. * @returns {Promise<boolean>} - Returns true if user has been logged out successfully. Otherwise, returns false. */ logout(): Promise<boolean>; static ɵfac: i0.ɵɵFactoryDeclaration<AuthenticationService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<AuthenticationService>; }