1 | export interface ValidationParams {
|
2 | idToken: string;
|
3 | accessToken: string;
|
4 | idTokenHeader: object;
|
5 | idTokenClaims: object;
|
6 | jwks: object;
|
7 | loadKeys: () => Promise<object>;
|
8 | }
|
9 | /**
|
10 | * Interface for Handlers that are hooked in to
|
11 | * validate tokens.
|
12 | */
|
13 | export declare abstract class ValidationHandler {
|
14 | /**
|
15 | * Validates the signature of an id_token.
|
16 | */
|
17 | abstract validateSignature(validationParams: ValidationParams): Promise<any>;
|
18 | /**
|
19 | * Validates the at_hash in an id_token against the received access_token.
|
20 | */
|
21 | abstract validateAtHash(validationParams: ValidationParams): Promise<boolean>;
|
22 | }
|
23 | /**
|
24 | * This abstract implementation of ValidationHandler already implements
|
25 | * the method validateAtHash. However, to make use of it,
|
26 | * you have to override the method calcHash.
|
27 | */
|
28 | export declare abstract class AbstractValidationHandler implements ValidationHandler {
|
29 | /**
|
30 | * Validates the signature of an id_token.
|
31 | */
|
32 | abstract validateSignature(validationParams: ValidationParams): Promise<any>;
|
33 | /**
|
34 | * Validates the at_hash in an id_token against the received access_token.
|
35 | */
|
36 | validateAtHash(params: ValidationParams): Promise<boolean>;
|
37 | /**
|
38 | * Infers the name of the hash algorithm to use
|
39 | * from the alg field of an id_token.
|
40 | *
|
41 | * @param jwtHeader the id_token's parsed header
|
42 | */
|
43 | protected inferHashAlgorithm(jwtHeader: object): string;
|
44 | /**
|
45 | * Calculates the hash for the passed value by using
|
46 | * the passed hash algorithm.
|
47 | *
|
48 | * @param valueToHash
|
49 | * @param algorithm
|
50 | */
|
51 | protected abstract calcHash(valueToHash: string, algorithm: string): Promise<string>;
|
52 | }
|