UNPKG

keycloak-typescript

Version:

A user friendly library to use keycloak in nodejs projects

37 lines (36 loc) 1.3 kB
import { IObserver } from '../observer/IObserver'; import { ITokenManager } from './Interfaces/ITokenManager'; import { KeycloakLogin } from '../models/keycloak-login'; export default class TokenManager extends ITokenManager { private readonly url; private accessToken?; private refreshToken?; private accessTokenExpireTime?; private refreshTokenExpireTime?; private clientId?; private clientSecret?; private username?; private password?; private refreshIntervalId?; private requestOfflineAccess; private isRefreshing; private hasWarnedShortTokens; constructor(url: string, observers?: IObserver[]); initializeManager: (keycloakLogin: KeycloakLogin) => Promise<void>; protected makeRefreshRequest: (apiConfig: { url: any; method?: string; headers?: Record<string, string>; body: any; }) => Promise<void>; protected refreshAccessToken: () => Promise<void>; /** * Re-authenticate using the password grant type when refresh token expires */ protected reauthenticateWithPassword: () => Promise<void>; /** * Schedule token refresh based on the expiration times returned by Keycloak */ protected scheduleTokenRefresh: () => void; protected notify: () => void; }