UNPKG

@koalarx/ui

Version:

Koala UI is a Design System developed in Angular whose objective is to facilitate and make your development faster and simpler, making this framework your greatest ally.

83 lines (82 loc) 3.19 kB
import { OnDestroy } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; import { HttpClient } from '@angular/common/http'; import { Router } from "@angular/router"; import { KoalaTokenService } from "../token/koala.token.service"; import * as i0 from "@angular/core"; export interface KoalaOAuth2Config { redirectUri: string; responseType: string; clientId: string; scope: string; issuer: string; redirectUriAfterAuth?: string; customQueryParams?: object; endpointToken?: string; endpointClaims?: string; } export interface KoalaOpenIdConfig { authorization_endpoint: string; check_session_iframe: string; claim_types_supported: string[]; claims_parameter_supported: boolean; claims_supported: string[]; code_challenge_methods_supported: string[]; end_session_endpoint: string; grant_types_supported: string[]; id_token_encryption_alg_values_supported: string[]; id_token_encryption_enc_values_supported: string[]; id_token_signing_alg_values_supported: string[]; introspection_endpoint: string; issuer: string; jwks_uri: string; registration_endpoint: string; request_object_signing_alg_values_supported: string[]; request_parameter_supported: boolean; request_uri_parameter_supported: boolean; response_modes_supported: string[]; response_types_supported: string[]; scopes_supported: string[]; subject_types_supported: string[]; tls_client_certificate_bound_access_tokens: boolean; token_endpoint: string; token_endpoint_auth_methods_supported: string[]; token_endpoint_auth_signing_alg_values_supported: string[]; token_introspection_endpoint: string; userinfo_endpoint: string; userinfo_signing_alg_values_supported: string[]; } export declare type EventType = 'loadedConfig' | 'getToken' | 'getTokenError' | 'refreshToken' | 'getClaims' | 'userAuthenticated' | 'authenticate' | 'logout' | 'errorLoadConfig'; export declare class KoalaOAuth2Service implements OnDestroy { private http; private router; private tokenService; events: BehaviorSubject<EventType>; private config; private openIdOptions; private eventSubscription; private state?; private code?; private token?; private claims?; private refreshTokenInterval?; constructor(http: HttpClient, router: Router, tokenService: KoalaTokenService); ngOnDestroy(): void; hasOpenIdConfig(): boolean; configure(options: KoalaOAuth2Config): void; loadDiscoveryDocumentAndTryLogin(): Promise<unknown>; initLoginFlow(name?: string): Promise<void>; getIdentityClaims(): any; getAccessToken(): any; getIdToken(): any; getRefreshToken(): any; getAccessTokenExpiration(): string; getCode(): string; logout(): void; initRefreshTokenInterval(code: string, refreshToken: string): void; private getToken; private getClaims; private generateState; static ɵfac: i0.ɵɵFactoryDeclaration<KoalaOAuth2Service, never>; static ɵprov: i0.ɵɵInjectableDeclaration<KoalaOAuth2Service>; }