UNPKG

2.65 kBTypeScriptView Raw
1import { AuthenticationParameters } from "../AuthenticationParameters";
2import { InteractionType } from "./Constants";
3import { StringDict } from "../MsalTypes";
4export declare type LibraryStateObject = {
5 id: string;
6 ts: number;
7 method: string;
8};
9/**
10 * @hidden
11 */
12export declare class RequestUtils {
13 /**
14 * @ignore
15 *
16 * @param request
17 * @param isLoginCall
18 * @param cacheStorage
19 * @param clientId
20 *
21 * validates all request parameters and generates a consumable request object
22 */
23 static validateRequest(request: AuthenticationParameters, isLoginCall: boolean, clientId: string, interactionType: InteractionType): AuthenticationParameters;
24 /**
25 * @ignore
26 *
27 * Utility to test if valid prompt value is passed in the request
28 * @param request
29 */
30 static validatePromptParameter(prompt: string): void;
31 /**
32 * @ignore
33 *
34 * Removes unnecessary or duplicate query parameters from extraQueryParameters
35 * @param request
36 */
37 static validateEQParameters(extraQueryParameters: StringDict, claimsRequest: string): StringDict;
38 /**
39 * @ignore
40 *
41 * Validates the claims passed in request is a JSON
42 * TODO: More validation will be added when the server team tells us how they have actually implemented claims
43 * @param claimsRequest
44 */
45 static validateClaimsRequest(claimsRequest: string): void;
46 /**
47 * @ignore
48 *
49 * generate unique state per request
50 * @param userState User-provided state value
51 * @returns State string include library state and user state
52 */
53 static validateAndGenerateState(userState: string, interactionType: InteractionType): string;
54 /**
55 * Generates the state value used by the library.
56 *
57 * @returns Base64 encoded string representing the state
58 */
59 static generateLibraryState(interactionType: InteractionType): string;
60 /**
61 * Decodes the state value into a StateObject
62 *
63 * @param state State value returned in the request
64 * @returns Parsed values from the encoded state value
65 */
66 static parseLibraryState(state: string): LibraryStateObject;
67 /**
68 * @ignore
69 *
70 * validate correlationId and generate if not valid or not set by the user
71 * @param correlationId
72 */
73 static validateAndGenerateCorrelationId(correlationId: string): string;
74 /**
75 * Create a request signature
76 * @param request
77 */
78 static createRequestSignature(request: AuthenticationParameters): string;
79}