ng-ebi-authorization
Version:
The ng-ebi-authorization is a simple authentication Angular library that relies on EBI's Authentication and Authorization Profile (AAP) infrastructure. After successful login, a JWT token is stored on the browser (via cookie, local or session storage).
24 lines (23 loc) • 841 B
TypeScript
import { JwtHelperService } from '@auth0/angular-jwt';
/**
* The purpose of this very simple service is to interface between the
* AuthService and the specific token manipulation routing of JwtHelperService.
* In this way, if in the future we want to replace JwtHelperService by
* another service, AuthService doesn't need to be modified, only this service.
*/
export declare class TokenService {
private _jwt;
constructor(_jwt: JwtHelperService);
getToken(): string | null;
getTokenExpirationDate(): Date | null;
isTokenValid(): boolean;
/**
* Get claims from the token.
*
* @param claim The name of the claim
* @param defaultValue The default value returned in case of error
*
* @returns claim or default value
*/
getClaim<T, C>(claim: string, defaultValue: C): T | C;
}