bfend
Version:
Admin template base on ng-zorro-antd
39 lines (38 loc) • 1.05 kB
TypeScript
import { Injector } from '@angular/core';
import { JwtHelperService } from '@auth0/angular-jwt';
import { LocalStorageService } from 'angular-web-storage';
import { BfendOptions } from '../options.type';
export interface TokenData {
access_token: string;
token_type?: string;
expires_in?: number;
refresh_token?: string;
refresh_token_valid_time?: number;
[key: string]: any;
}
export declare class BfTokenStorage {
private storage;
private options;
constructor(storage: LocalStorageService, options: BfendOptions);
readonly key: string;
/**
* 保存
*/
/**
* 获取
*/
data: TokenData | null;
readonly token: string;
clean(): void;
}
export declare class BfTokenService {
private injector;
private helper;
private storage;
constructor(injector: Injector, helper: JwtHelperService, storage: BfTokenStorage);
data: TokenData | null;
readonly token: string;
clean(): void;
isExpired(token?: any): boolean;
isValid(token?: any): boolean;
}