Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Hierarchy

  • TokenService

Index

Constructors

constructor

  • Parameters

    • _jwt: JwtHelperService

    Returns TokenService

Properties

Private _jwt

_jwt: JwtHelperService

Methods

getClaim

  • getClaim<T, C>(claim: string, defaultValue: C): T | C
  • Get claims from the token.

    Type parameters

    • T

    • C

    Parameters

    • claim: string

      The name of the claim

    • defaultValue: C

      The default value returned in case of error

    Returns T | C

    claim or default value

getToken

  • getToken(): string | null
  • Returns string | null

getTokenExpirationDate

  • getTokenExpirationDate(): Date | null
  • Returns Date | null

isTokenValid

  • isTokenValid(): boolean
  • Returns boolean

Generated using TypeDoc