1 | export declare abstract class NbAuthToken {
|
2 | protected payload: any;
|
3 | abstract getValue(): string;
|
4 | abstract isValid(): boolean;
|
5 | abstract getOwnerStrategyName(): string;
|
6 | abstract getCreatedAt(): Date;
|
7 | abstract toString(): string;
|
8 | getName(): string;
|
9 | getPayload(): any;
|
10 | }
|
11 | export declare class NbAuthTokenNotFoundError extends Error {
|
12 | constructor(message: string);
|
13 | }
|
14 | export declare class NbAuthIllegalTokenError extends Error {
|
15 | constructor(message: string);
|
16 | }
|
17 | export declare class NbAuthEmptyTokenError extends NbAuthIllegalTokenError {
|
18 | constructor(message: string);
|
19 | }
|
20 | export declare class NbAuthIllegalJWTTokenError extends NbAuthIllegalTokenError {
|
21 | constructor(message: string);
|
22 | }
|
23 | export interface NbAuthRefreshableToken {
|
24 | getRefreshToken(): string;
|
25 | setRefreshToken(refreshToken: string): any;
|
26 | }
|
27 | export interface NbAuthTokenClass<T = NbAuthToken> {
|
28 | NAME: string;
|
29 | new (raw: any, strategyName: string, expDate?: Date): T;
|
30 | }
|
31 | export declare function nbAuthCreateToken<T extends NbAuthToken>(tokenClass: NbAuthTokenClass<T>, token: any, ownerStrategyName: string, createdAt?: Date): T;
|
32 | export declare function decodeJwtPayload(payload: string): any;
|
33 |
|
34 |
|
35 |
|
36 | export declare class NbAuthSimpleToken extends NbAuthToken {
|
37 | protected readonly token: any;
|
38 | protected readonly ownerStrategyName: string;
|
39 | protected createdAt?: Date;
|
40 | static NAME: string;
|
41 | constructor(token: any, ownerStrategyName: string, createdAt?: Date);
|
42 | protected parsePayload(): any;
|
43 | protected prepareCreatedAt(date: Date): Date;
|
44 | /**
|
45 | * Returns the token's creation date
|
46 | * @returns {Date}
|
47 | */
|
48 | getCreatedAt(): Date;
|
49 | |
50 |
|
51 |
|
52 |
|
53 | getValue(): string;
|
54 | getOwnerStrategyName(): string;
|
55 | |
56 |
|
57 |
|
58 |
|
59 | isValid(): boolean;
|
60 | |
61 |
|
62 |
|
63 |
|
64 | toString(): string;
|
65 | }
|
66 |
|
67 |
|
68 |
|
69 | export declare class NbAuthJWTToken extends NbAuthSimpleToken {
|
70 | static NAME: string;
|
71 | |
72 |
|
73 |
|
74 | protected prepareCreatedAt(date: Date): Date;
|
75 | |
76 |
|
77 |
|
78 |
|
79 | protected parsePayload(): void;
|
80 | |
81 |
|
82 |
|
83 |
|
84 | getTokenExpDate(): Date;
|
85 | |
86 |
|
87 |
|
88 |
|
89 | isValid(): boolean;
|
90 | }
|
91 |
|
92 |
|
93 |
|
94 | export declare class NbAuthOAuth2Token extends NbAuthSimpleToken {
|
95 | static NAME: string;
|
96 | constructor(data: {
|
97 | [key: string]: string | number;
|
98 | } | string, ownerStrategyName: string, createdAt?: Date);
|
99 | /**
|
100 | * Returns the token value
|
101 | * @returns string
|
102 | */
|
103 | getValue(): string;
|
104 | /**
|
105 | * Returns the refresh token
|
106 | * @returns string
|
107 | */
|
108 | getRefreshToken(): string;
|
109 | /**
|
110 | * put refreshToken in the token payload
|
111 | * @param refreshToken
|
112 | */
|
113 | setRefreshToken(refreshToken: string): void;
|
114 | /**
|
115 | * Parses token payload
|
116 | * @returns any
|
117 | */
|
118 | protected parsePayload(): void;
|
119 | /**
|
120 | * Returns the token type
|
121 | * @returns string
|
122 | */
|
123 | getType(): string;
|
124 | /**
|
125 | * Is data expired
|
126 | * @returns {boolean}
|
127 | */
|
128 | isValid(): boolean;
|
129 | |
130 |
|
131 |
|
132 |
|
133 | getTokenExpDate(): Date;
|
134 | |
135 |
|
136 |
|
137 |
|
138 | toString(): string;
|
139 | }
|
140 |
|
141 |
|
142 |
|
143 | export declare class NbAuthOAuth2JWTToken extends NbAuthOAuth2Token {
|
144 | static NAME: string;
|
145 | protected accessTokenPayload: any;
|
146 | protected parsePayload(): void;
|
147 | protected parseAccessTokenPayload(): any;
|
148 | |
149 |
|
150 |
|
151 |
|
152 | getAccessTokenPayload(): any;
|
153 | |
154 |
|
155 |
|
156 | protected prepareCreatedAt(date: Date): Date;
|
157 | |
158 |
|
159 |
|
160 |
|
161 | isValid(): boolean;
|
162 | |
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 | getTokenExpDate(): Date;
|
169 | }
|