@alfresco/adf-core
Version:
56 lines (55 loc) • 2.4 kB
TypeScript
import { OAuthService, OAuthStorage } from 'angular-oauth2-oidc';
import { Observable } from 'rxjs';
import { AppConfigService } from '../../app-config/app-config.service';
import { BaseAuthenticationService } from '../services/base-authentication.service';
import { CookieService } from '../../common/services/cookie.service';
import { JwtHelperService } from '../services/jwt-helper.service';
import { AuthConfigService } from './auth-config.service';
import { AuthService } from './auth.service';
import { HttpHeaders } from '@angular/common/http';
import * as i0 from "@angular/core";
export declare class OidcAuthenticationService extends BaseAuthenticationService {
private jwtHelperService;
private authStorage;
private oauthService;
private readonly authConfig;
private readonly auth;
constructor(appConfig: AppConfigService, cookie: CookieService, jwtHelperService: JwtHelperService, authStorage: OAuthStorage, oauthService: OAuthService, authConfig: AuthConfigService, auth: AuthService);
/**
* Observable that determines whether an SSO login should be performed.
*
* This observable combines the authentication status and the discovery document load status
* to decide if an SSO login is necessary. It emits `true` if the user is not authenticated
* and the discovery document is loaded, otherwise it emits `false`.
*/
shouldPerformSsoLogin$: Observable<boolean>;
isLoggedIn(): boolean;
hasValidAccessToken(): boolean;
hasValidIdToken(): boolean;
login(username: string, password: string): Observable<{
type: string;
ticket: any;
}>;
loginWithPassword(username: string, password: string): Observable<{
type: string;
ticket: any;
}>;
/**
* Gets the username of the authenticated user.
*
* @returns the logged username
*/
getUsername(): string;
ssoLogin(redirectUrl?: string): void;
isRememberMeSet(): boolean;
logout(): Observable<never>;
getToken(): string;
reset(): void;
isPublicUrl(): boolean;
getAuthHeaders(_requestUrl: string, header: HttpHeaders): HttpHeaders;
private addBearerToken;
private getLogoutOptions;
private getLogoutParamValue;
static ɵfac: i0.ɵɵFactoryDeclaration<OidcAuthenticationService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<OidcAuthenticationService>;
}