UNPKG

6.1 kBTypeScriptView Raw
1import { Logger } from "./Logger";
2import { TelemetryEmitter } from "./telemetry/TelemetryTypes";
3/**
4 * Cache location options supported by MSAL are:
5 * - local storage: MSAL uses browsers local storage to store its cache
6 * - session storage: MSAL uses the browsers session storage to store its cache
7 */
8export declare type CacheLocation = "localStorage" | "sessionStorage";
9/**
10 * @type AuthOptions: Use this to configure the auth options in the Configuration object
11 *
12 * - clientId - Client ID of your app registered with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview in Microsoft Identity Platform
13 * - authority - You can configure a specific authority, defaults to " " or "https://login.microsoftonline.com/common"
14 * - validateAuthority - Used to turn authority validation on/off. When set to true (default), MSAL will compare the application's authority against well-known URLs templates representing well-formed authorities. It is useful when the authority is obtained at run time to prevent MSAL from displaying authentication prompts from malicious pages.
15 * - authorityMetadata - OpenID configuration metadata for the configured authority. Must be passed as a JSON string.
16 * - knownAuthorities - If validateAuthority is set to True, this will be used to set the Trusted Host list. Defaults to empty array
17 * - redirectUri - The redirect URI of the application, this should be same as the value in the application registration portal.Defaults to `window.location.href`.
18 * - postLogoutRedirectUri - Used to redirect the user to this location after logout. Defaults to `window.location.href`.
19 * - navigateToLoginRequestUrl - Used to turn off default navigation to start page after login. Default is true. This is used only for redirect flows.
20 *
21 */
22export declare type AuthOptions = {
23 clientId: string;
24 authority?: string;
25 validateAuthority?: boolean;
26 authorityMetadata?: string;
27 knownAuthorities?: Array<string>;
28 redirectUri?: string | (() => string);
29 postLogoutRedirectUri?: string | (() => string);
30 navigateToLoginRequestUrl?: boolean;
31};
32/**
33 * Use this to configure the below cache configuration options:
34 *
35 * - cacheLocation - Used to specify the cacheLocation user wants to set. Valid values are "localStorage" and "sessionStorage"
36 * - storeAuthStateInCookie - If set, MSAL store's the auth request state required for validation of the auth flows in the browser cookies. By default this flag is set to false.
37 */
38export declare type CacheOptions = {
39 cacheLocation?: CacheLocation;
40 storeAuthStateInCookie?: boolean;
41};
42/**
43 * Telemetry Config Options
44 * - applicationName - Name of the consuming apps application
45 * - applicationVersion - Verison of the consuming application
46 * - telemetryEmitter - Function where telemetry events are flushed to
47 */
48export declare type TelemetryOptions = {
49 applicationName: string;
50 applicationVersion: string;
51 telemetryEmitter: TelemetryEmitter;
52};
53/**
54 * Library Specific Options
55 *
56 * - logger - Used to initialize the Logger object; TODO: Expand on logger details or link to the documentation on logger
57 * - loadFrameTimeout - maximum time the library should wait for a frame to load
58 * - tokenRenewalOffsetSeconds - sets the window of offset needed to renew the token before expiry
59 * - navigateFrameWait - sets the wait time for hidden iFrame navigation
60 */
61export declare type SystemOptions = {
62 logger?: Logger;
63 loadFrameTimeout?: number;
64 tokenRenewalOffsetSeconds?: number;
65 navigateFrameWait?: number;
66 telemetry?: TelemetryOptions;
67};
68/**
69 * App/Framework specific environment support
70 *
71 * - isAngular - flag set to determine if it is Angular Framework. MSAL uses this to broadcast tokens. More to come here: detangle this dependency from core.
72 * - unprotectedResources - Array of URI's which are unprotected resources. MSAL will not attach a token to outgoing requests that have these URI. Defaults to 'null'.
73 * - protectedResourceMap - This is mapping of resources to scopes used by MSAL for automatically attaching access tokens in web API calls.A single access token is obtained for the resource. So you can map a specific resource path as follows: {"https://graph.microsoft.com/v1.0/me", ["user.read"]}, or the app URL of the resource as: {"https://graph.microsoft.com/", ["user.read", "mail.send"]}. This is required for CORS calls.
74 *
75 */
76export declare type FrameworkOptions = {
77 isAngular?: boolean;
78 unprotectedResources?: Array<string>;
79 protectedResourceMap?: Map<string, Array<string>>;
80};
81/**
82 * Use the configuration object to configure MSAL and initialize the UserAgentApplication.
83 *
84 * This object allows you to configure important elements of MSAL functionality:
85 * - auth: this is where you configure auth elements like clientID, authority used for authenticating against the Microsoft Identity Platform
86 * - cache: this is where you configure cache location and whether to store cache in cookies
87 * - system: this is where you can configure the logger, frame timeout etc.
88 * - framework: this is where you can configure the running mode of angular. More to come here soon.
89 */
90export declare type Configuration = {
91 auth: AuthOptions;
92 cache?: CacheOptions;
93 system?: SystemOptions;
94 framework?: FrameworkOptions;
95};
96/**
97 * MSAL function that sets the default options when not explicitly configured from app developer
98 *
99 * @param TAuthOptions
100 * @param TCacheOptions
101 * @param TSystemOptions
102 * @param TFrameworkOptions
103 * @param TAuthorityDataOptions
104 *
105 * @returns TConfiguration object
106 */
107export declare function buildConfiguration({ auth, cache, system, framework }: Configuration): Configuration;
108
\No newline at end of file