@azure/msal-common 14.0.0-alpha.1 → 14.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +62 -62
- package/dist/account/AccountInfo.d.ts +31 -31
- package/dist/account/AuthToken.d.ts +20 -20
- package/dist/account/AuthToken.js +48 -48
- package/dist/account/CcsCredential.d.ts +8 -8
- package/dist/account/CcsCredential.js +9 -9
- package/dist/account/ClientCredentials.d.ts +14 -14
- package/dist/account/ClientInfo.d.ts +19 -19
- package/dist/account/ClientInfo.js +37 -37
- package/dist/account/DecodedAuthToken.d.ts +8 -8
- package/dist/account/TokenClaims.d.ts +65 -65
- package/dist/authority/Authority.d.ts +228 -215
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.js +716 -682
- package/dist/authority/Authority.js.map +1 -1
- package/dist/authority/AuthorityFactory.d.ts +30 -30
- package/dist/authority/AuthorityFactory.js +47 -47
- package/dist/authority/AuthorityMetadata.d.ts +622 -622
- package/dist/authority/AuthorityMetadata.js +876 -876
- package/dist/authority/AuthorityOptions.d.ts +18 -18
- package/dist/authority/AuthorityOptions.js +19 -19
- package/dist/authority/AuthorityType.d.ts +9 -9
- package/dist/authority/AuthorityType.js +14 -14
- package/dist/authority/AzureRegion.d.ts +1 -1
- package/dist/authority/AzureRegionConfiguration.d.ts +5 -5
- package/dist/authority/CloudDiscoveryMetadata.d.ts +5 -5
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.d.ts +13 -13
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.js +8 -8
- package/dist/authority/CloudInstanceDiscoveryResponse.d.ts +9 -9
- package/dist/authority/CloudInstanceDiscoveryResponse.js +8 -8
- package/dist/authority/ImdsOptions.d.ts +5 -5
- package/dist/authority/OpenIdConfigResponse.d.ts +11 -11
- package/dist/authority/OpenIdConfigResponse.js +10 -10
- package/dist/authority/ProtocolMode.d.ts +7 -7
- package/dist/authority/ProtocolMode.js +12 -12
- package/dist/authority/RegionDiscovery.d.ts +30 -30
- package/dist/authority/RegionDiscovery.js +108 -108
- package/dist/authority/RegionDiscoveryMetadata.d.ts +6 -6
- package/dist/broker/nativeBroker/INativeBrokerPlugin.d.ts +15 -15
- package/dist/cache/CacheManager.d.ts +443 -443
- package/dist/cache/CacheManager.js +1011 -1011
- package/dist/cache/entities/AccessTokenEntity.d.ts +56 -56
- package/dist/cache/entities/AccessTokenEntity.js +111 -111
- package/dist/cache/entities/AccountEntity.d.ts +99 -99
- package/dist/cache/entities/AccountEntity.js +248 -248
- package/dist/cache/entities/AppMetadataEntity.d.ts +39 -39
- package/dist/cache/entities/AppMetadataEntity.js +66 -66
- package/dist/cache/entities/AuthorityMetadataEntity.d.ts +47 -47
- package/dist/cache/entities/AuthorityMetadataEntity.js +77 -77
- package/dist/cache/entities/CacheRecord.d.ts +13 -13
- package/dist/cache/entities/CacheRecord.js +13 -13
- package/dist/cache/entities/CredentialEntity.d.ts +88 -88
- package/dist/cache/entities/CredentialEntity.js +136 -136
- package/dist/cache/entities/IdTokenEntity.d.ts +34 -34
- package/dist/cache/entities/IdTokenEntity.js +56 -56
- package/dist/cache/entities/RefreshTokenEntity.d.ts +36 -36
- package/dist/cache/entities/RefreshTokenEntity.js +59 -59
- package/dist/cache/entities/ServerTelemetryEntity.d.ts +12 -12
- package/dist/cache/entities/ServerTelemetryEntity.js +27 -27
- package/dist/cache/entities/ThrottlingEntity.d.ts +13 -13
- package/dist/cache/entities/ThrottlingEntity.js +23 -23
- package/dist/cache/interface/ICacheManager.d.ts +165 -165
- package/dist/cache/interface/ICachePlugin.d.ts +5 -5
- package/dist/cache/interface/ISerializableTokenCache.d.ts +4 -4
- package/dist/cache/persistence/TokenCacheContext.d.ts +23 -23
- package/dist/cache/persistence/TokenCacheContext.js +25 -25
- package/dist/cache/utils/CacheTypes.d.ts +62 -62
- package/dist/client/AuthorizationCodeClient.d.ts +71 -71
- package/dist/client/AuthorizationCodeClient.js +433 -433
- package/dist/client/BaseClient.d.ts +50 -50
- package/dist/client/BaseClient.js +92 -92
- package/dist/client/RefreshTokenClient.d.ts +34 -34
- package/dist/client/RefreshTokenClient.js +239 -239
- package/dist/client/SilentFlowClient.d.ts +24 -24
- package/dist/client/SilentFlowClient.js +94 -94
- package/dist/config/AppTokenProvider.d.ts +38 -38
- package/dist/config/ClientConfiguration.d.ts +133 -133
- package/dist/config/ClientConfiguration.js +88 -88
- package/dist/crypto/ICrypto.d.ts +62 -62
- package/dist/crypto/ICrypto.js +42 -42
- package/dist/crypto/IGuidGenerator.d.ts +4 -4
- package/dist/crypto/JoseHeader.d.ts +21 -21
- package/dist/crypto/JoseHeader.js +36 -36
- package/dist/crypto/PopTokenGenerator.d.ts +57 -57
- package/dist/crypto/PopTokenGenerator.js +83 -83
- package/dist/crypto/SignedHttpRequest.d.ts +11 -11
- package/dist/error/AuthError.d.ts +47 -47
- package/dist/error/AuthError.js +51 -51
- package/dist/error/ClientAuthError.d.ts +412 -412
- package/dist/error/ClientAuthError.js +519 -519
- package/dist/error/ClientConfigurationError.d.ts +198 -198
- package/dist/error/ClientConfigurationError.js +249 -249
- package/dist/error/InteractionRequiredAuthError.d.ts +59 -59
- package/dist/error/InteractionRequiredAuthError.js +78 -78
- package/dist/error/JoseHeaderError.d.ts +28 -28
- package/dist/error/JoseHeaderError.js +39 -39
- package/dist/error/ServerError.d.ts +7 -7
- package/dist/error/ServerError.js +14 -14
- package/dist/index.cjs.js +8843 -8809
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +93 -93
- package/dist/index.js +1 -1
- package/dist/logger/Logger.d.ts +95 -95
- package/dist/logger/Logger.js +197 -197
- package/dist/network/INetworkModule.d.ts +29 -29
- package/dist/network/INetworkModule.js +14 -14
- package/dist/network/NetworkManager.d.ts +32 -32
- package/dist/network/NetworkManager.js +33 -33
- package/dist/network/RequestThumbprint.d.ts +16 -16
- package/dist/network/ThrottlingUtils.d.ts +41 -41
- package/dist/network/ThrottlingUtils.js +94 -94
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.js +4 -4
- package/dist/request/AuthenticationHeaderParser.d.ts +19 -19
- package/dist/request/AuthenticationHeaderParser.js +55 -55
- package/dist/request/BaseAuthRequest.d.ts +37 -37
- package/dist/request/CommonAuthorizationCodeRequest.d.ts +27 -27
- package/dist/request/CommonAuthorizationUrlRequest.d.ts +50 -50
- package/dist/request/CommonClientCredentialRequest.d.ts +17 -17
- package/dist/request/CommonDeviceCodeRequest.d.ts +21 -21
- package/dist/request/CommonEndSessionRequest.d.ts +21 -21
- package/dist/request/CommonOnBehalfOfRequest.d.ts +13 -13
- package/dist/request/CommonRefreshTokenRequest.d.ts +19 -19
- package/dist/request/CommonSilentFlowRequest.d.ts +18 -18
- package/dist/request/CommonUsernamePasswordRequest.d.ts +17 -17
- package/dist/request/NativeRequest.d.ts +19 -19
- package/dist/request/NativeSignOutRequest.d.ts +5 -5
- package/dist/request/RequestParameterBuilder.d.ts +216 -216
- package/dist/request/RequestParameterBuilder.js +374 -374
- package/dist/request/RequestValidator.d.ts +33 -33
- package/dist/request/RequestValidator.js +83 -83
- package/dist/request/ScopeSet.d.ts +88 -88
- package/dist/request/ScopeSet.js +197 -197
- package/dist/response/AuthenticationResult.d.ts +39 -39
- package/dist/response/AuthorizationCodePayload.d.ts +13 -13
- package/dist/response/DeviceCodeResponse.d.ts +25 -25
- package/dist/response/ExternalTokenResponse.d.ts +15 -15
- package/dist/response/IMDSBadResponse.d.ts +4 -4
- package/dist/response/ResponseHandler.d.ts +72 -72
- package/dist/response/ResponseHandler.js +300 -300
- package/dist/response/ServerAuthorizationCodeResponse.d.ts +25 -25
- package/dist/response/ServerAuthorizationTokenResponse.d.ts +44 -44
- package/dist/telemetry/performance/IPerformanceClient.d.ts +42 -42
- package/dist/telemetry/performance/IPerformanceMeasurement.d.ts +5 -5
- package/dist/telemetry/performance/PerformanceClient.d.ts +189 -189
- package/dist/telemetry/performance/PerformanceClient.js +406 -406
- package/dist/telemetry/performance/PerformanceEvent.d.ts +439 -439
- package/dist/telemetry/performance/PerformanceEvent.js +227 -227
- package/dist/telemetry/performance/StubPerformanceClient.d.ts +19 -19
- package/dist/telemetry/performance/StubPerformanceClient.js +36 -36
- package/dist/telemetry/server/ServerTelemetryManager.d.ts +65 -65
- package/dist/telemetry/server/ServerTelemetryManager.js +196 -196
- package/dist/telemetry/server/ServerTelemetryRequest.d.ts +8 -8
- package/dist/url/IUri.d.ts +12 -12
- package/dist/url/UrlString.d.ts +70 -70
- package/dist/url/UrlString.js +242 -242
- package/dist/utils/Constants.d.ts +331 -331
- package/dist/utils/Constants.js +373 -373
- package/dist/utils/MsalTypes.d.ts +6 -6
- package/dist/utils/ProtocolUtils.d.ts +42 -42
- package/dist/utils/ProtocolUtils.js +71 -71
- package/dist/utils/StringUtils.d.ts +53 -53
- package/dist/utils/StringUtils.js +124 -124
- package/dist/utils/TimeUtils.d.ts +27 -27
- package/dist/utils/TimeUtils.js +45 -45
- package/package.json +79 -79
package/dist/utils/Constants.js
CHANGED
|
@@ -1,377 +1,377 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.0.0-alpha.
|
|
1
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
2
2
|
'use strict';
|
|
3
|
-
/*
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License.
|
|
6
|
-
*/
|
|
7
|
-
const Constants = {
|
|
8
|
-
LIBRARY_NAME: "MSAL.JS",
|
|
9
|
-
SKU: "msal.js.common",
|
|
10
|
-
// Prefix for all library cache entries
|
|
11
|
-
CACHE_PREFIX: "msal",
|
|
12
|
-
// default authority
|
|
13
|
-
DEFAULT_AUTHORITY: "https://login.microsoftonline.com/common/",
|
|
14
|
-
DEFAULT_AUTHORITY_HOST: "login.microsoftonline.com",
|
|
15
|
-
DEFAULT_COMMON_TENANT: "common",
|
|
16
|
-
// ADFS String
|
|
17
|
-
ADFS: "adfs",
|
|
18
|
-
DSTS: "dstsv2",
|
|
19
|
-
// Default AAD Instance Discovery Endpoint
|
|
20
|
-
AAD_INSTANCE_DISCOVERY_ENDPT: "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",
|
|
21
|
-
// CIAM URL
|
|
22
|
-
CIAM_AUTH_URL: ".ciamlogin.com",
|
|
23
|
-
AAD_TENANT_DOMAIN_SUFFIX: ".onmicrosoft.com",
|
|
24
|
-
// Resource delimiter - used for certain cache entries
|
|
25
|
-
RESOURCE_DELIM: "|",
|
|
26
|
-
// Placeholder for non-existent account ids/objects
|
|
27
|
-
NO_ACCOUNT: "NO_ACCOUNT",
|
|
28
|
-
// Claims
|
|
29
|
-
CLAIMS: "claims",
|
|
30
|
-
// Consumer UTID
|
|
31
|
-
CONSUMER_UTID: "9188040d-6c67-4c5b-b112-36a304b66dad",
|
|
32
|
-
// Default scopes
|
|
33
|
-
OPENID_SCOPE: "openid",
|
|
34
|
-
PROFILE_SCOPE: "profile",
|
|
35
|
-
OFFLINE_ACCESS_SCOPE: "offline_access",
|
|
36
|
-
EMAIL_SCOPE: "email",
|
|
37
|
-
// Default response type for authorization code flow
|
|
38
|
-
CODE_RESPONSE_TYPE: "code",
|
|
39
|
-
CODE_GRANT_TYPE: "authorization_code",
|
|
40
|
-
RT_GRANT_TYPE: "refresh_token",
|
|
41
|
-
FRAGMENT_RESPONSE_MODE: "fragment",
|
|
42
|
-
S256_CODE_CHALLENGE_METHOD: "S256",
|
|
43
|
-
URL_FORM_CONTENT_TYPE: "application/x-www-form-urlencoded;charset=utf-8",
|
|
44
|
-
AUTHORIZATION_PENDING: "authorization_pending",
|
|
45
|
-
NOT_DEFINED: "not_defined",
|
|
46
|
-
EMPTY_STRING: "",
|
|
47
|
-
NOT_APPLICABLE: "N/A",
|
|
48
|
-
FORWARD_SLASH: "/",
|
|
49
|
-
IMDS_ENDPOINT: "http://169.254.169.254/metadata/instance/compute/location",
|
|
50
|
-
IMDS_VERSION: "2020-06-01",
|
|
51
|
-
IMDS_TIMEOUT: 2000,
|
|
52
|
-
AZURE_REGION_AUTO_DISCOVER_FLAG: "TryAutoDetect",
|
|
53
|
-
REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX: "login.microsoft.com",
|
|
54
|
-
REGIONAL_AUTH_NON_MSI_QUERY_STRING: "allowestsrnonmsi=true",
|
|
55
|
-
KNOWN_PUBLIC_CLOUDS: [
|
|
56
|
-
"login.microsoftonline.com",
|
|
57
|
-
"login.windows.net",
|
|
58
|
-
"login.microsoft.com",
|
|
59
|
-
"sts.windows.net",
|
|
60
|
-
],
|
|
61
|
-
TOKEN_RESPONSE_TYPE: "token",
|
|
62
|
-
ID_TOKEN_RESPONSE_TYPE: "id_token",
|
|
63
|
-
SHR_NONCE_VALIDITY: 240,
|
|
64
|
-
INVALID_INSTANCE: "invalid_instance",
|
|
65
|
-
};
|
|
66
|
-
const OIDC_DEFAULT_SCOPES = [
|
|
67
|
-
Constants.OPENID_SCOPE,
|
|
68
|
-
Constants.PROFILE_SCOPE,
|
|
69
|
-
Constants.OFFLINE_ACCESS_SCOPE,
|
|
70
|
-
];
|
|
71
|
-
const OIDC_SCOPES = [...OIDC_DEFAULT_SCOPES, Constants.EMAIL_SCOPE];
|
|
72
|
-
/**
|
|
73
|
-
* Request header names
|
|
74
|
-
*/
|
|
75
|
-
var HeaderNames;
|
|
76
|
-
(function (HeaderNames) {
|
|
77
|
-
HeaderNames["CONTENT_TYPE"] = "Content-Type";
|
|
78
|
-
HeaderNames["RETRY_AFTER"] = "Retry-After";
|
|
79
|
-
HeaderNames["CCS_HEADER"] = "X-AnchorMailbox";
|
|
80
|
-
HeaderNames["WWWAuthenticate"] = "WWW-Authenticate";
|
|
81
|
-
HeaderNames["AuthenticationInfo"] = "Authentication-Info";
|
|
82
|
-
HeaderNames["X_MS_REQUEST_ID"] = "x-ms-request-id";
|
|
83
|
-
HeaderNames["X_MS_HTTP_VERSION"] = "x-ms-httpver";
|
|
84
|
-
})(HeaderNames || (HeaderNames = {}));
|
|
85
|
-
/**
|
|
86
|
-
* Persistent cache keys MSAL which stay while user is logged in.
|
|
87
|
-
*/
|
|
88
|
-
var PersistentCacheKeys;
|
|
89
|
-
(function (PersistentCacheKeys) {
|
|
90
|
-
PersistentCacheKeys["ID_TOKEN"] = "idtoken";
|
|
91
|
-
PersistentCacheKeys["CLIENT_INFO"] = "client.info";
|
|
92
|
-
PersistentCacheKeys["ADAL_ID_TOKEN"] = "adal.idtoken";
|
|
93
|
-
PersistentCacheKeys["ERROR"] = "error";
|
|
94
|
-
PersistentCacheKeys["ERROR_DESC"] = "error.description";
|
|
95
|
-
PersistentCacheKeys["ACTIVE_ACCOUNT"] = "active-account";
|
|
96
|
-
PersistentCacheKeys["ACTIVE_ACCOUNT_FILTERS"] = "active-account-filters";
|
|
97
|
-
})(PersistentCacheKeys || (PersistentCacheKeys = {}));
|
|
98
|
-
/**
|
|
99
|
-
* String constants related to AAD Authority
|
|
100
|
-
*/
|
|
101
|
-
var AADAuthorityConstants;
|
|
102
|
-
(function (AADAuthorityConstants) {
|
|
103
|
-
AADAuthorityConstants["COMMON"] = "common";
|
|
104
|
-
AADAuthorityConstants["ORGANIZATIONS"] = "organizations";
|
|
105
|
-
AADAuthorityConstants["CONSUMERS"] = "consumers";
|
|
106
|
-
})(AADAuthorityConstants || (AADAuthorityConstants = {}));
|
|
107
|
-
/**
|
|
108
|
-
* Keys in the hashParams sent by AAD Server
|
|
109
|
-
*/
|
|
110
|
-
var AADServerParamKeys;
|
|
111
|
-
(function (AADServerParamKeys) {
|
|
112
|
-
AADServerParamKeys["CLIENT_ID"] = "client_id";
|
|
113
|
-
AADServerParamKeys["REDIRECT_URI"] = "redirect_uri";
|
|
114
|
-
AADServerParamKeys["RESPONSE_TYPE"] = "response_type";
|
|
115
|
-
AADServerParamKeys["RESPONSE_MODE"] = "response_mode";
|
|
116
|
-
AADServerParamKeys["GRANT_TYPE"] = "grant_type";
|
|
117
|
-
AADServerParamKeys["CLAIMS"] = "claims";
|
|
118
|
-
AADServerParamKeys["SCOPE"] = "scope";
|
|
119
|
-
AADServerParamKeys["ERROR"] = "error";
|
|
120
|
-
AADServerParamKeys["ERROR_DESCRIPTION"] = "error_description";
|
|
121
|
-
AADServerParamKeys["ACCESS_TOKEN"] = "access_token";
|
|
122
|
-
AADServerParamKeys["ID_TOKEN"] = "id_token";
|
|
123
|
-
AADServerParamKeys["REFRESH_TOKEN"] = "refresh_token";
|
|
124
|
-
AADServerParamKeys["EXPIRES_IN"] = "expires_in";
|
|
125
|
-
AADServerParamKeys["STATE"] = "state";
|
|
126
|
-
AADServerParamKeys["NONCE"] = "nonce";
|
|
127
|
-
AADServerParamKeys["PROMPT"] = "prompt";
|
|
128
|
-
AADServerParamKeys["SESSION_STATE"] = "session_state";
|
|
129
|
-
AADServerParamKeys["CLIENT_INFO"] = "client_info";
|
|
130
|
-
AADServerParamKeys["CODE"] = "code";
|
|
131
|
-
AADServerParamKeys["CODE_CHALLENGE"] = "code_challenge";
|
|
132
|
-
AADServerParamKeys["CODE_CHALLENGE_METHOD"] = "code_challenge_method";
|
|
133
|
-
AADServerParamKeys["CODE_VERIFIER"] = "code_verifier";
|
|
134
|
-
AADServerParamKeys["CLIENT_REQUEST_ID"] = "client-request-id";
|
|
135
|
-
AADServerParamKeys["X_CLIENT_SKU"] = "x-client-SKU";
|
|
136
|
-
AADServerParamKeys["X_CLIENT_VER"] = "x-client-VER";
|
|
137
|
-
AADServerParamKeys["X_CLIENT_OS"] = "x-client-OS";
|
|
138
|
-
AADServerParamKeys["X_CLIENT_CPU"] = "x-client-CPU";
|
|
139
|
-
AADServerParamKeys["X_CLIENT_CURR_TELEM"] = "x-client-current-telemetry";
|
|
140
|
-
AADServerParamKeys["X_CLIENT_LAST_TELEM"] = "x-client-last-telemetry";
|
|
141
|
-
AADServerParamKeys["X_MS_LIB_CAPABILITY"] = "x-ms-lib-capability";
|
|
142
|
-
AADServerParamKeys["X_APP_NAME"] = "x-app-name";
|
|
143
|
-
AADServerParamKeys["X_APP_VER"] = "x-app-ver";
|
|
144
|
-
AADServerParamKeys["POST_LOGOUT_URI"] = "post_logout_redirect_uri";
|
|
145
|
-
AADServerParamKeys["ID_TOKEN_HINT"] = "id_token_hint";
|
|
146
|
-
AADServerParamKeys["DEVICE_CODE"] = "device_code";
|
|
147
|
-
AADServerParamKeys["CLIENT_SECRET"] = "client_secret";
|
|
148
|
-
AADServerParamKeys["CLIENT_ASSERTION"] = "client_assertion";
|
|
149
|
-
AADServerParamKeys["CLIENT_ASSERTION_TYPE"] = "client_assertion_type";
|
|
150
|
-
AADServerParamKeys["TOKEN_TYPE"] = "token_type";
|
|
151
|
-
AADServerParamKeys["REQ_CNF"] = "req_cnf";
|
|
152
|
-
AADServerParamKeys["OBO_ASSERTION"] = "assertion";
|
|
153
|
-
AADServerParamKeys["REQUESTED_TOKEN_USE"] = "requested_token_use";
|
|
154
|
-
AADServerParamKeys["ON_BEHALF_OF"] = "on_behalf_of";
|
|
155
|
-
AADServerParamKeys["FOCI"] = "foci";
|
|
156
|
-
AADServerParamKeys["CCS_HEADER"] = "X-AnchorMailbox";
|
|
157
|
-
AADServerParamKeys["RETURN_SPA_CODE"] = "return_spa_code";
|
|
158
|
-
AADServerParamKeys["NATIVE_BROKER"] = "nativebroker";
|
|
159
|
-
AADServerParamKeys["LOGOUT_HINT"] = "logout_hint";
|
|
160
|
-
})(AADServerParamKeys || (AADServerParamKeys = {}));
|
|
161
|
-
/**
|
|
162
|
-
* Claims request keys
|
|
163
|
-
*/
|
|
164
|
-
var ClaimsRequestKeys;
|
|
165
|
-
(function (ClaimsRequestKeys) {
|
|
166
|
-
ClaimsRequestKeys["ACCESS_TOKEN"] = "access_token";
|
|
167
|
-
ClaimsRequestKeys["XMS_CC"] = "xms_cc";
|
|
168
|
-
})(ClaimsRequestKeys || (ClaimsRequestKeys = {}));
|
|
169
|
-
/**
|
|
170
|
-
* we considered making this "enum" in the request instead of string, however it looks like the allowed list of
|
|
171
|
-
* prompt values kept changing over past couple of years. There are some undocumented prompt values for some
|
|
172
|
-
* internal partners too, hence the choice of generic "string" type instead of the "enum"
|
|
173
|
-
*/
|
|
174
|
-
const PromptValue = {
|
|
175
|
-
LOGIN: "login",
|
|
176
|
-
SELECT_ACCOUNT: "select_account",
|
|
177
|
-
CONSENT: "consent",
|
|
178
|
-
NONE: "none",
|
|
179
|
-
CREATE: "create",
|
|
180
|
-
NO_SESSION: "no_session",
|
|
181
|
-
};
|
|
182
|
-
/**
|
|
183
|
-
* SSO Types - generated to populate hints
|
|
184
|
-
*/
|
|
185
|
-
var SSOTypes;
|
|
186
|
-
(function (SSOTypes) {
|
|
187
|
-
SSOTypes["ACCOUNT"] = "account";
|
|
188
|
-
SSOTypes["SID"] = "sid";
|
|
189
|
-
SSOTypes["LOGIN_HINT"] = "login_hint";
|
|
190
|
-
SSOTypes["ID_TOKEN"] = "id_token";
|
|
191
|
-
SSOTypes["DOMAIN_HINT"] = "domain_hint";
|
|
192
|
-
SSOTypes["ORGANIZATIONS"] = "organizations";
|
|
193
|
-
SSOTypes["CONSUMERS"] = "consumers";
|
|
194
|
-
SSOTypes["ACCOUNT_ID"] = "accountIdentifier";
|
|
195
|
-
SSOTypes["HOMEACCOUNT_ID"] = "homeAccountIdentifier";
|
|
196
|
-
})(SSOTypes || (SSOTypes = {}));
|
|
197
|
-
/**
|
|
198
|
-
* allowed values for codeVerifier
|
|
199
|
-
*/
|
|
200
|
-
const CodeChallengeMethodValues = {
|
|
201
|
-
PLAIN: "plain",
|
|
202
|
-
S256: "S256",
|
|
203
|
-
};
|
|
204
|
-
/**
|
|
205
|
-
* allowed values for response_mode
|
|
206
|
-
*/
|
|
207
|
-
var ResponseMode;
|
|
208
|
-
(function (ResponseMode) {
|
|
209
|
-
ResponseMode["QUERY"] = "query";
|
|
210
|
-
ResponseMode["FRAGMENT"] = "fragment";
|
|
211
|
-
ResponseMode["FORM_POST"] = "form_post";
|
|
212
|
-
})(ResponseMode || (ResponseMode = {}));
|
|
213
|
-
/**
|
|
214
|
-
* allowed grant_type
|
|
215
|
-
*/
|
|
216
|
-
var GrantType;
|
|
217
|
-
(function (GrantType) {
|
|
218
|
-
GrantType["IMPLICIT_GRANT"] = "implicit";
|
|
219
|
-
GrantType["AUTHORIZATION_CODE_GRANT"] = "authorization_code";
|
|
220
|
-
GrantType["CLIENT_CREDENTIALS_GRANT"] = "client_credentials";
|
|
221
|
-
GrantType["RESOURCE_OWNER_PASSWORD_GRANT"] = "password";
|
|
222
|
-
GrantType["REFRESH_TOKEN_GRANT"] = "refresh_token";
|
|
223
|
-
GrantType["DEVICE_CODE_GRANT"] = "device_code";
|
|
224
|
-
GrantType["JWT_BEARER"] = "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
|
225
|
-
})(GrantType || (GrantType = {}));
|
|
226
|
-
/**
|
|
227
|
-
* Account types in Cache
|
|
228
|
-
*/
|
|
229
|
-
var CacheAccountType;
|
|
230
|
-
(function (CacheAccountType) {
|
|
231
|
-
CacheAccountType["MSSTS_ACCOUNT_TYPE"] = "MSSTS";
|
|
232
|
-
CacheAccountType["ADFS_ACCOUNT_TYPE"] = "ADFS";
|
|
233
|
-
CacheAccountType["MSAV1_ACCOUNT_TYPE"] = "MSA";
|
|
234
|
-
CacheAccountType["GENERIC_ACCOUNT_TYPE"] = "Generic";
|
|
235
|
-
})(CacheAccountType || (CacheAccountType = {}));
|
|
236
|
-
/**
|
|
237
|
-
* Separators used in cache
|
|
238
|
-
*/
|
|
239
|
-
var Separators;
|
|
240
|
-
(function (Separators) {
|
|
241
|
-
Separators["CACHE_KEY_SEPARATOR"] = "-";
|
|
242
|
-
Separators["CLIENT_INFO_SEPARATOR"] = ".";
|
|
243
|
-
})(Separators || (Separators = {}));
|
|
244
|
-
/**
|
|
245
|
-
* Credential Type stored in the cache
|
|
246
|
-
*/
|
|
247
|
-
var CredentialType;
|
|
248
|
-
(function (CredentialType) {
|
|
249
|
-
CredentialType["ID_TOKEN"] = "IdToken";
|
|
250
|
-
CredentialType["ACCESS_TOKEN"] = "AccessToken";
|
|
251
|
-
CredentialType["ACCESS_TOKEN_WITH_AUTH_SCHEME"] = "AccessToken_With_AuthScheme";
|
|
252
|
-
CredentialType["REFRESH_TOKEN"] = "RefreshToken";
|
|
253
|
-
})(CredentialType || (CredentialType = {}));
|
|
254
|
-
/**
|
|
255
|
-
* Combine all cache types
|
|
256
|
-
*/
|
|
257
|
-
var CacheType;
|
|
258
|
-
(function (CacheType) {
|
|
259
|
-
CacheType[CacheType["ADFS"] = 1001] = "ADFS";
|
|
260
|
-
CacheType[CacheType["MSA"] = 1002] = "MSA";
|
|
261
|
-
CacheType[CacheType["MSSTS"] = 1003] = "MSSTS";
|
|
262
|
-
CacheType[CacheType["GENERIC"] = 1004] = "GENERIC";
|
|
263
|
-
CacheType[CacheType["ACCESS_TOKEN"] = 2001] = "ACCESS_TOKEN";
|
|
264
|
-
CacheType[CacheType["REFRESH_TOKEN"] = 2002] = "REFRESH_TOKEN";
|
|
265
|
-
CacheType[CacheType["ID_TOKEN"] = 2003] = "ID_TOKEN";
|
|
266
|
-
CacheType[CacheType["APP_METADATA"] = 3001] = "APP_METADATA";
|
|
267
|
-
CacheType[CacheType["UNDEFINED"] = 9999] = "UNDEFINED";
|
|
268
|
-
})(CacheType || (CacheType = {}));
|
|
269
|
-
/**
|
|
270
|
-
* More Cache related constants
|
|
271
|
-
*/
|
|
272
|
-
const APP_METADATA = "appmetadata";
|
|
273
|
-
const CLIENT_INFO = "client_info";
|
|
274
|
-
const THE_FAMILY_ID = "1";
|
|
275
|
-
const AUTHORITY_METADATA_CONSTANTS = {
|
|
276
|
-
CACHE_KEY: "authority-metadata",
|
|
277
|
-
REFRESH_TIME_SECONDS: 3600 * 24, // 24 Hours
|
|
278
|
-
};
|
|
279
|
-
var AuthorityMetadataSource;
|
|
280
|
-
(function (AuthorityMetadataSource) {
|
|
281
|
-
AuthorityMetadataSource["CONFIG"] = "config";
|
|
282
|
-
AuthorityMetadataSource["CACHE"] = "cache";
|
|
283
|
-
AuthorityMetadataSource["NETWORK"] = "network";
|
|
284
|
-
AuthorityMetadataSource["HARDCODED_VALUES"] = "hardcoded_values";
|
|
285
|
-
})(AuthorityMetadataSource || (AuthorityMetadataSource = {}));
|
|
286
|
-
const SERVER_TELEM_CONSTANTS = {
|
|
287
|
-
SCHEMA_VERSION: 5,
|
|
288
|
-
MAX_CUR_HEADER_BYTES: 80,
|
|
289
|
-
MAX_LAST_HEADER_BYTES: 330,
|
|
290
|
-
MAX_CACHED_ERRORS: 50,
|
|
291
|
-
CACHE_KEY: "server-telemetry",
|
|
292
|
-
CATEGORY_SEPARATOR: "|",
|
|
293
|
-
VALUE_SEPARATOR: ",",
|
|
294
|
-
OVERFLOW_TRUE: "1",
|
|
295
|
-
OVERFLOW_FALSE: "0",
|
|
296
|
-
UNKNOWN_ERROR: "unknown_error",
|
|
297
|
-
};
|
|
298
|
-
/**
|
|
299
|
-
* Type of the authentication request
|
|
300
|
-
*/
|
|
301
|
-
var AuthenticationScheme;
|
|
302
|
-
(function (AuthenticationScheme) {
|
|
303
|
-
AuthenticationScheme["BEARER"] = "Bearer";
|
|
304
|
-
AuthenticationScheme["POP"] = "pop";
|
|
305
|
-
AuthenticationScheme["SSH"] = "ssh-cert";
|
|
306
|
-
})(AuthenticationScheme || (AuthenticationScheme = {}));
|
|
307
|
-
/**
|
|
308
|
-
* Constants related to throttling
|
|
309
|
-
*/
|
|
310
|
-
const ThrottlingConstants = {
|
|
311
|
-
// Default time to throttle RequestThumbprint in seconds
|
|
312
|
-
DEFAULT_THROTTLE_TIME_SECONDS: 60,
|
|
313
|
-
// Default maximum time to throttle in seconds, overrides what the server sends back
|
|
314
|
-
DEFAULT_MAX_THROTTLE_TIME_SECONDS: 3600,
|
|
315
|
-
// Prefix for storing throttling entries
|
|
316
|
-
THROTTLING_PREFIX: "throttling",
|
|
317
|
-
// Value assigned to the x-ms-lib-capability header to indicate to the server the library supports throttling
|
|
318
|
-
X_MS_LIB_CAPABILITY_VALUE: "retry-after, h429",
|
|
319
|
-
};
|
|
320
|
-
const Errors = {
|
|
321
|
-
INVALID_GRANT_ERROR: "invalid_grant",
|
|
322
|
-
CLIENT_MISMATCH_ERROR: "client_mismatch",
|
|
323
|
-
};
|
|
324
|
-
/**
|
|
325
|
-
* Password grant parameters
|
|
326
|
-
*/
|
|
327
|
-
var PasswordGrantConstants;
|
|
328
|
-
(function (PasswordGrantConstants) {
|
|
329
|
-
PasswordGrantConstants["username"] = "username";
|
|
330
|
-
PasswordGrantConstants["password"] = "password";
|
|
331
|
-
})(PasswordGrantConstants || (PasswordGrantConstants = {}));
|
|
332
|
-
/**
|
|
333
|
-
* Response codes
|
|
334
|
-
*/
|
|
335
|
-
var ResponseCodes;
|
|
336
|
-
(function (ResponseCodes) {
|
|
337
|
-
ResponseCodes[ResponseCodes["httpSuccess"] = 200] = "httpSuccess";
|
|
338
|
-
ResponseCodes[ResponseCodes["httpBadRequest"] = 400] = "httpBadRequest";
|
|
339
|
-
})(ResponseCodes || (ResponseCodes = {}));
|
|
340
|
-
/**
|
|
341
|
-
* Region Discovery Sources
|
|
342
|
-
*/
|
|
343
|
-
var RegionDiscoverySources;
|
|
344
|
-
(function (RegionDiscoverySources) {
|
|
345
|
-
RegionDiscoverySources["FAILED_AUTO_DETECTION"] = "1";
|
|
346
|
-
RegionDiscoverySources["INTERNAL_CACHE"] = "2";
|
|
347
|
-
RegionDiscoverySources["ENVIRONMENT_VARIABLE"] = "3";
|
|
348
|
-
RegionDiscoverySources["IMDS"] = "4";
|
|
349
|
-
})(RegionDiscoverySources || (RegionDiscoverySources = {}));
|
|
350
|
-
/**
|
|
351
|
-
* Region Discovery Outcomes
|
|
352
|
-
*/
|
|
353
|
-
var RegionDiscoveryOutcomes;
|
|
354
|
-
(function (RegionDiscoveryOutcomes) {
|
|
355
|
-
RegionDiscoveryOutcomes["CONFIGURED_MATCHES_DETECTED"] = "1";
|
|
356
|
-
RegionDiscoveryOutcomes["CONFIGURED_NO_AUTO_DETECTION"] = "2";
|
|
357
|
-
RegionDiscoveryOutcomes["CONFIGURED_NOT_DETECTED"] = "3";
|
|
358
|
-
RegionDiscoveryOutcomes["AUTO_DETECTION_REQUESTED_SUCCESSFUL"] = "4";
|
|
359
|
-
RegionDiscoveryOutcomes["AUTO_DETECTION_REQUESTED_FAILED"] = "5";
|
|
360
|
-
})(RegionDiscoveryOutcomes || (RegionDiscoveryOutcomes = {}));
|
|
361
|
-
var CacheOutcome;
|
|
362
|
-
(function (CacheOutcome) {
|
|
363
|
-
CacheOutcome["NO_CACHE_HIT"] = "0";
|
|
364
|
-
CacheOutcome["FORCE_REFRESH"] = "1";
|
|
365
|
-
CacheOutcome["NO_CACHED_ACCESS_TOKEN"] = "2";
|
|
366
|
-
CacheOutcome["CACHED_ACCESS_TOKEN_EXPIRED"] = "3";
|
|
367
|
-
CacheOutcome["REFRESH_CACHED_ACCESS_TOKEN"] = "4";
|
|
368
|
-
})(CacheOutcome || (CacheOutcome = {}));
|
|
369
|
-
var JsonTypes;
|
|
370
|
-
(function (JsonTypes) {
|
|
371
|
-
JsonTypes["Jwt"] = "JWT";
|
|
372
|
-
JsonTypes["Jwk"] = "JWK";
|
|
373
|
-
JsonTypes["Pop"] = "pop";
|
|
374
|
-
})(JsonTypes || (JsonTypes = {}));
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
* Licensed under the MIT License.
|
|
6
|
+
*/
|
|
7
|
+
const Constants = {
|
|
8
|
+
LIBRARY_NAME: "MSAL.JS",
|
|
9
|
+
SKU: "msal.js.common",
|
|
10
|
+
// Prefix for all library cache entries
|
|
11
|
+
CACHE_PREFIX: "msal",
|
|
12
|
+
// default authority
|
|
13
|
+
DEFAULT_AUTHORITY: "https://login.microsoftonline.com/common/",
|
|
14
|
+
DEFAULT_AUTHORITY_HOST: "login.microsoftonline.com",
|
|
15
|
+
DEFAULT_COMMON_TENANT: "common",
|
|
16
|
+
// ADFS String
|
|
17
|
+
ADFS: "adfs",
|
|
18
|
+
DSTS: "dstsv2",
|
|
19
|
+
// Default AAD Instance Discovery Endpoint
|
|
20
|
+
AAD_INSTANCE_DISCOVERY_ENDPT: "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",
|
|
21
|
+
// CIAM URL
|
|
22
|
+
CIAM_AUTH_URL: ".ciamlogin.com",
|
|
23
|
+
AAD_TENANT_DOMAIN_SUFFIX: ".onmicrosoft.com",
|
|
24
|
+
// Resource delimiter - used for certain cache entries
|
|
25
|
+
RESOURCE_DELIM: "|",
|
|
26
|
+
// Placeholder for non-existent account ids/objects
|
|
27
|
+
NO_ACCOUNT: "NO_ACCOUNT",
|
|
28
|
+
// Claims
|
|
29
|
+
CLAIMS: "claims",
|
|
30
|
+
// Consumer UTID
|
|
31
|
+
CONSUMER_UTID: "9188040d-6c67-4c5b-b112-36a304b66dad",
|
|
32
|
+
// Default scopes
|
|
33
|
+
OPENID_SCOPE: "openid",
|
|
34
|
+
PROFILE_SCOPE: "profile",
|
|
35
|
+
OFFLINE_ACCESS_SCOPE: "offline_access",
|
|
36
|
+
EMAIL_SCOPE: "email",
|
|
37
|
+
// Default response type for authorization code flow
|
|
38
|
+
CODE_RESPONSE_TYPE: "code",
|
|
39
|
+
CODE_GRANT_TYPE: "authorization_code",
|
|
40
|
+
RT_GRANT_TYPE: "refresh_token",
|
|
41
|
+
FRAGMENT_RESPONSE_MODE: "fragment",
|
|
42
|
+
S256_CODE_CHALLENGE_METHOD: "S256",
|
|
43
|
+
URL_FORM_CONTENT_TYPE: "application/x-www-form-urlencoded;charset=utf-8",
|
|
44
|
+
AUTHORIZATION_PENDING: "authorization_pending",
|
|
45
|
+
NOT_DEFINED: "not_defined",
|
|
46
|
+
EMPTY_STRING: "",
|
|
47
|
+
NOT_APPLICABLE: "N/A",
|
|
48
|
+
FORWARD_SLASH: "/",
|
|
49
|
+
IMDS_ENDPOINT: "http://169.254.169.254/metadata/instance/compute/location",
|
|
50
|
+
IMDS_VERSION: "2020-06-01",
|
|
51
|
+
IMDS_TIMEOUT: 2000,
|
|
52
|
+
AZURE_REGION_AUTO_DISCOVER_FLAG: "TryAutoDetect",
|
|
53
|
+
REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX: "login.microsoft.com",
|
|
54
|
+
REGIONAL_AUTH_NON_MSI_QUERY_STRING: "allowestsrnonmsi=true",
|
|
55
|
+
KNOWN_PUBLIC_CLOUDS: [
|
|
56
|
+
"login.microsoftonline.com",
|
|
57
|
+
"login.windows.net",
|
|
58
|
+
"login.microsoft.com",
|
|
59
|
+
"sts.windows.net",
|
|
60
|
+
],
|
|
61
|
+
TOKEN_RESPONSE_TYPE: "token",
|
|
62
|
+
ID_TOKEN_RESPONSE_TYPE: "id_token",
|
|
63
|
+
SHR_NONCE_VALIDITY: 240,
|
|
64
|
+
INVALID_INSTANCE: "invalid_instance",
|
|
65
|
+
};
|
|
66
|
+
const OIDC_DEFAULT_SCOPES = [
|
|
67
|
+
Constants.OPENID_SCOPE,
|
|
68
|
+
Constants.PROFILE_SCOPE,
|
|
69
|
+
Constants.OFFLINE_ACCESS_SCOPE,
|
|
70
|
+
];
|
|
71
|
+
const OIDC_SCOPES = [...OIDC_DEFAULT_SCOPES, Constants.EMAIL_SCOPE];
|
|
72
|
+
/**
|
|
73
|
+
* Request header names
|
|
74
|
+
*/
|
|
75
|
+
var HeaderNames;
|
|
76
|
+
(function (HeaderNames) {
|
|
77
|
+
HeaderNames["CONTENT_TYPE"] = "Content-Type";
|
|
78
|
+
HeaderNames["RETRY_AFTER"] = "Retry-After";
|
|
79
|
+
HeaderNames["CCS_HEADER"] = "X-AnchorMailbox";
|
|
80
|
+
HeaderNames["WWWAuthenticate"] = "WWW-Authenticate";
|
|
81
|
+
HeaderNames["AuthenticationInfo"] = "Authentication-Info";
|
|
82
|
+
HeaderNames["X_MS_REQUEST_ID"] = "x-ms-request-id";
|
|
83
|
+
HeaderNames["X_MS_HTTP_VERSION"] = "x-ms-httpver";
|
|
84
|
+
})(HeaderNames || (HeaderNames = {}));
|
|
85
|
+
/**
|
|
86
|
+
* Persistent cache keys MSAL which stay while user is logged in.
|
|
87
|
+
*/
|
|
88
|
+
var PersistentCacheKeys;
|
|
89
|
+
(function (PersistentCacheKeys) {
|
|
90
|
+
PersistentCacheKeys["ID_TOKEN"] = "idtoken";
|
|
91
|
+
PersistentCacheKeys["CLIENT_INFO"] = "client.info";
|
|
92
|
+
PersistentCacheKeys["ADAL_ID_TOKEN"] = "adal.idtoken";
|
|
93
|
+
PersistentCacheKeys["ERROR"] = "error";
|
|
94
|
+
PersistentCacheKeys["ERROR_DESC"] = "error.description";
|
|
95
|
+
PersistentCacheKeys["ACTIVE_ACCOUNT"] = "active-account";
|
|
96
|
+
PersistentCacheKeys["ACTIVE_ACCOUNT_FILTERS"] = "active-account-filters";
|
|
97
|
+
})(PersistentCacheKeys || (PersistentCacheKeys = {}));
|
|
98
|
+
/**
|
|
99
|
+
* String constants related to AAD Authority
|
|
100
|
+
*/
|
|
101
|
+
var AADAuthorityConstants;
|
|
102
|
+
(function (AADAuthorityConstants) {
|
|
103
|
+
AADAuthorityConstants["COMMON"] = "common";
|
|
104
|
+
AADAuthorityConstants["ORGANIZATIONS"] = "organizations";
|
|
105
|
+
AADAuthorityConstants["CONSUMERS"] = "consumers";
|
|
106
|
+
})(AADAuthorityConstants || (AADAuthorityConstants = {}));
|
|
107
|
+
/**
|
|
108
|
+
* Keys in the hashParams sent by AAD Server
|
|
109
|
+
*/
|
|
110
|
+
var AADServerParamKeys;
|
|
111
|
+
(function (AADServerParamKeys) {
|
|
112
|
+
AADServerParamKeys["CLIENT_ID"] = "client_id";
|
|
113
|
+
AADServerParamKeys["REDIRECT_URI"] = "redirect_uri";
|
|
114
|
+
AADServerParamKeys["RESPONSE_TYPE"] = "response_type";
|
|
115
|
+
AADServerParamKeys["RESPONSE_MODE"] = "response_mode";
|
|
116
|
+
AADServerParamKeys["GRANT_TYPE"] = "grant_type";
|
|
117
|
+
AADServerParamKeys["CLAIMS"] = "claims";
|
|
118
|
+
AADServerParamKeys["SCOPE"] = "scope";
|
|
119
|
+
AADServerParamKeys["ERROR"] = "error";
|
|
120
|
+
AADServerParamKeys["ERROR_DESCRIPTION"] = "error_description";
|
|
121
|
+
AADServerParamKeys["ACCESS_TOKEN"] = "access_token";
|
|
122
|
+
AADServerParamKeys["ID_TOKEN"] = "id_token";
|
|
123
|
+
AADServerParamKeys["REFRESH_TOKEN"] = "refresh_token";
|
|
124
|
+
AADServerParamKeys["EXPIRES_IN"] = "expires_in";
|
|
125
|
+
AADServerParamKeys["STATE"] = "state";
|
|
126
|
+
AADServerParamKeys["NONCE"] = "nonce";
|
|
127
|
+
AADServerParamKeys["PROMPT"] = "prompt";
|
|
128
|
+
AADServerParamKeys["SESSION_STATE"] = "session_state";
|
|
129
|
+
AADServerParamKeys["CLIENT_INFO"] = "client_info";
|
|
130
|
+
AADServerParamKeys["CODE"] = "code";
|
|
131
|
+
AADServerParamKeys["CODE_CHALLENGE"] = "code_challenge";
|
|
132
|
+
AADServerParamKeys["CODE_CHALLENGE_METHOD"] = "code_challenge_method";
|
|
133
|
+
AADServerParamKeys["CODE_VERIFIER"] = "code_verifier";
|
|
134
|
+
AADServerParamKeys["CLIENT_REQUEST_ID"] = "client-request-id";
|
|
135
|
+
AADServerParamKeys["X_CLIENT_SKU"] = "x-client-SKU";
|
|
136
|
+
AADServerParamKeys["X_CLIENT_VER"] = "x-client-VER";
|
|
137
|
+
AADServerParamKeys["X_CLIENT_OS"] = "x-client-OS";
|
|
138
|
+
AADServerParamKeys["X_CLIENT_CPU"] = "x-client-CPU";
|
|
139
|
+
AADServerParamKeys["X_CLIENT_CURR_TELEM"] = "x-client-current-telemetry";
|
|
140
|
+
AADServerParamKeys["X_CLIENT_LAST_TELEM"] = "x-client-last-telemetry";
|
|
141
|
+
AADServerParamKeys["X_MS_LIB_CAPABILITY"] = "x-ms-lib-capability";
|
|
142
|
+
AADServerParamKeys["X_APP_NAME"] = "x-app-name";
|
|
143
|
+
AADServerParamKeys["X_APP_VER"] = "x-app-ver";
|
|
144
|
+
AADServerParamKeys["POST_LOGOUT_URI"] = "post_logout_redirect_uri";
|
|
145
|
+
AADServerParamKeys["ID_TOKEN_HINT"] = "id_token_hint";
|
|
146
|
+
AADServerParamKeys["DEVICE_CODE"] = "device_code";
|
|
147
|
+
AADServerParamKeys["CLIENT_SECRET"] = "client_secret";
|
|
148
|
+
AADServerParamKeys["CLIENT_ASSERTION"] = "client_assertion";
|
|
149
|
+
AADServerParamKeys["CLIENT_ASSERTION_TYPE"] = "client_assertion_type";
|
|
150
|
+
AADServerParamKeys["TOKEN_TYPE"] = "token_type";
|
|
151
|
+
AADServerParamKeys["REQ_CNF"] = "req_cnf";
|
|
152
|
+
AADServerParamKeys["OBO_ASSERTION"] = "assertion";
|
|
153
|
+
AADServerParamKeys["REQUESTED_TOKEN_USE"] = "requested_token_use";
|
|
154
|
+
AADServerParamKeys["ON_BEHALF_OF"] = "on_behalf_of";
|
|
155
|
+
AADServerParamKeys["FOCI"] = "foci";
|
|
156
|
+
AADServerParamKeys["CCS_HEADER"] = "X-AnchorMailbox";
|
|
157
|
+
AADServerParamKeys["RETURN_SPA_CODE"] = "return_spa_code";
|
|
158
|
+
AADServerParamKeys["NATIVE_BROKER"] = "nativebroker";
|
|
159
|
+
AADServerParamKeys["LOGOUT_HINT"] = "logout_hint";
|
|
160
|
+
})(AADServerParamKeys || (AADServerParamKeys = {}));
|
|
161
|
+
/**
|
|
162
|
+
* Claims request keys
|
|
163
|
+
*/
|
|
164
|
+
var ClaimsRequestKeys;
|
|
165
|
+
(function (ClaimsRequestKeys) {
|
|
166
|
+
ClaimsRequestKeys["ACCESS_TOKEN"] = "access_token";
|
|
167
|
+
ClaimsRequestKeys["XMS_CC"] = "xms_cc";
|
|
168
|
+
})(ClaimsRequestKeys || (ClaimsRequestKeys = {}));
|
|
169
|
+
/**
|
|
170
|
+
* we considered making this "enum" in the request instead of string, however it looks like the allowed list of
|
|
171
|
+
* prompt values kept changing over past couple of years. There are some undocumented prompt values for some
|
|
172
|
+
* internal partners too, hence the choice of generic "string" type instead of the "enum"
|
|
173
|
+
*/
|
|
174
|
+
const PromptValue = {
|
|
175
|
+
LOGIN: "login",
|
|
176
|
+
SELECT_ACCOUNT: "select_account",
|
|
177
|
+
CONSENT: "consent",
|
|
178
|
+
NONE: "none",
|
|
179
|
+
CREATE: "create",
|
|
180
|
+
NO_SESSION: "no_session",
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* SSO Types - generated to populate hints
|
|
184
|
+
*/
|
|
185
|
+
var SSOTypes;
|
|
186
|
+
(function (SSOTypes) {
|
|
187
|
+
SSOTypes["ACCOUNT"] = "account";
|
|
188
|
+
SSOTypes["SID"] = "sid";
|
|
189
|
+
SSOTypes["LOGIN_HINT"] = "login_hint";
|
|
190
|
+
SSOTypes["ID_TOKEN"] = "id_token";
|
|
191
|
+
SSOTypes["DOMAIN_HINT"] = "domain_hint";
|
|
192
|
+
SSOTypes["ORGANIZATIONS"] = "organizations";
|
|
193
|
+
SSOTypes["CONSUMERS"] = "consumers";
|
|
194
|
+
SSOTypes["ACCOUNT_ID"] = "accountIdentifier";
|
|
195
|
+
SSOTypes["HOMEACCOUNT_ID"] = "homeAccountIdentifier";
|
|
196
|
+
})(SSOTypes || (SSOTypes = {}));
|
|
197
|
+
/**
|
|
198
|
+
* allowed values for codeVerifier
|
|
199
|
+
*/
|
|
200
|
+
const CodeChallengeMethodValues = {
|
|
201
|
+
PLAIN: "plain",
|
|
202
|
+
S256: "S256",
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* allowed values for response_mode
|
|
206
|
+
*/
|
|
207
|
+
var ResponseMode;
|
|
208
|
+
(function (ResponseMode) {
|
|
209
|
+
ResponseMode["QUERY"] = "query";
|
|
210
|
+
ResponseMode["FRAGMENT"] = "fragment";
|
|
211
|
+
ResponseMode["FORM_POST"] = "form_post";
|
|
212
|
+
})(ResponseMode || (ResponseMode = {}));
|
|
213
|
+
/**
|
|
214
|
+
* allowed grant_type
|
|
215
|
+
*/
|
|
216
|
+
var GrantType;
|
|
217
|
+
(function (GrantType) {
|
|
218
|
+
GrantType["IMPLICIT_GRANT"] = "implicit";
|
|
219
|
+
GrantType["AUTHORIZATION_CODE_GRANT"] = "authorization_code";
|
|
220
|
+
GrantType["CLIENT_CREDENTIALS_GRANT"] = "client_credentials";
|
|
221
|
+
GrantType["RESOURCE_OWNER_PASSWORD_GRANT"] = "password";
|
|
222
|
+
GrantType["REFRESH_TOKEN_GRANT"] = "refresh_token";
|
|
223
|
+
GrantType["DEVICE_CODE_GRANT"] = "device_code";
|
|
224
|
+
GrantType["JWT_BEARER"] = "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
|
225
|
+
})(GrantType || (GrantType = {}));
|
|
226
|
+
/**
|
|
227
|
+
* Account types in Cache
|
|
228
|
+
*/
|
|
229
|
+
var CacheAccountType;
|
|
230
|
+
(function (CacheAccountType) {
|
|
231
|
+
CacheAccountType["MSSTS_ACCOUNT_TYPE"] = "MSSTS";
|
|
232
|
+
CacheAccountType["ADFS_ACCOUNT_TYPE"] = "ADFS";
|
|
233
|
+
CacheAccountType["MSAV1_ACCOUNT_TYPE"] = "MSA";
|
|
234
|
+
CacheAccountType["GENERIC_ACCOUNT_TYPE"] = "Generic";
|
|
235
|
+
})(CacheAccountType || (CacheAccountType = {}));
|
|
236
|
+
/**
|
|
237
|
+
* Separators used in cache
|
|
238
|
+
*/
|
|
239
|
+
var Separators;
|
|
240
|
+
(function (Separators) {
|
|
241
|
+
Separators["CACHE_KEY_SEPARATOR"] = "-";
|
|
242
|
+
Separators["CLIENT_INFO_SEPARATOR"] = ".";
|
|
243
|
+
})(Separators || (Separators = {}));
|
|
244
|
+
/**
|
|
245
|
+
* Credential Type stored in the cache
|
|
246
|
+
*/
|
|
247
|
+
var CredentialType;
|
|
248
|
+
(function (CredentialType) {
|
|
249
|
+
CredentialType["ID_TOKEN"] = "IdToken";
|
|
250
|
+
CredentialType["ACCESS_TOKEN"] = "AccessToken";
|
|
251
|
+
CredentialType["ACCESS_TOKEN_WITH_AUTH_SCHEME"] = "AccessToken_With_AuthScheme";
|
|
252
|
+
CredentialType["REFRESH_TOKEN"] = "RefreshToken";
|
|
253
|
+
})(CredentialType || (CredentialType = {}));
|
|
254
|
+
/**
|
|
255
|
+
* Combine all cache types
|
|
256
|
+
*/
|
|
257
|
+
var CacheType;
|
|
258
|
+
(function (CacheType) {
|
|
259
|
+
CacheType[CacheType["ADFS"] = 1001] = "ADFS";
|
|
260
|
+
CacheType[CacheType["MSA"] = 1002] = "MSA";
|
|
261
|
+
CacheType[CacheType["MSSTS"] = 1003] = "MSSTS";
|
|
262
|
+
CacheType[CacheType["GENERIC"] = 1004] = "GENERIC";
|
|
263
|
+
CacheType[CacheType["ACCESS_TOKEN"] = 2001] = "ACCESS_TOKEN";
|
|
264
|
+
CacheType[CacheType["REFRESH_TOKEN"] = 2002] = "REFRESH_TOKEN";
|
|
265
|
+
CacheType[CacheType["ID_TOKEN"] = 2003] = "ID_TOKEN";
|
|
266
|
+
CacheType[CacheType["APP_METADATA"] = 3001] = "APP_METADATA";
|
|
267
|
+
CacheType[CacheType["UNDEFINED"] = 9999] = "UNDEFINED";
|
|
268
|
+
})(CacheType || (CacheType = {}));
|
|
269
|
+
/**
|
|
270
|
+
* More Cache related constants
|
|
271
|
+
*/
|
|
272
|
+
const APP_METADATA = "appmetadata";
|
|
273
|
+
const CLIENT_INFO = "client_info";
|
|
274
|
+
const THE_FAMILY_ID = "1";
|
|
275
|
+
const AUTHORITY_METADATA_CONSTANTS = {
|
|
276
|
+
CACHE_KEY: "authority-metadata",
|
|
277
|
+
REFRESH_TIME_SECONDS: 3600 * 24, // 24 Hours
|
|
278
|
+
};
|
|
279
|
+
var AuthorityMetadataSource;
|
|
280
|
+
(function (AuthorityMetadataSource) {
|
|
281
|
+
AuthorityMetadataSource["CONFIG"] = "config";
|
|
282
|
+
AuthorityMetadataSource["CACHE"] = "cache";
|
|
283
|
+
AuthorityMetadataSource["NETWORK"] = "network";
|
|
284
|
+
AuthorityMetadataSource["HARDCODED_VALUES"] = "hardcoded_values";
|
|
285
|
+
})(AuthorityMetadataSource || (AuthorityMetadataSource = {}));
|
|
286
|
+
const SERVER_TELEM_CONSTANTS = {
|
|
287
|
+
SCHEMA_VERSION: 5,
|
|
288
|
+
MAX_CUR_HEADER_BYTES: 80,
|
|
289
|
+
MAX_LAST_HEADER_BYTES: 330,
|
|
290
|
+
MAX_CACHED_ERRORS: 50,
|
|
291
|
+
CACHE_KEY: "server-telemetry",
|
|
292
|
+
CATEGORY_SEPARATOR: "|",
|
|
293
|
+
VALUE_SEPARATOR: ",",
|
|
294
|
+
OVERFLOW_TRUE: "1",
|
|
295
|
+
OVERFLOW_FALSE: "0",
|
|
296
|
+
UNKNOWN_ERROR: "unknown_error",
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Type of the authentication request
|
|
300
|
+
*/
|
|
301
|
+
var AuthenticationScheme;
|
|
302
|
+
(function (AuthenticationScheme) {
|
|
303
|
+
AuthenticationScheme["BEARER"] = "Bearer";
|
|
304
|
+
AuthenticationScheme["POP"] = "pop";
|
|
305
|
+
AuthenticationScheme["SSH"] = "ssh-cert";
|
|
306
|
+
})(AuthenticationScheme || (AuthenticationScheme = {}));
|
|
307
|
+
/**
|
|
308
|
+
* Constants related to throttling
|
|
309
|
+
*/
|
|
310
|
+
const ThrottlingConstants = {
|
|
311
|
+
// Default time to throttle RequestThumbprint in seconds
|
|
312
|
+
DEFAULT_THROTTLE_TIME_SECONDS: 60,
|
|
313
|
+
// Default maximum time to throttle in seconds, overrides what the server sends back
|
|
314
|
+
DEFAULT_MAX_THROTTLE_TIME_SECONDS: 3600,
|
|
315
|
+
// Prefix for storing throttling entries
|
|
316
|
+
THROTTLING_PREFIX: "throttling",
|
|
317
|
+
// Value assigned to the x-ms-lib-capability header to indicate to the server the library supports throttling
|
|
318
|
+
X_MS_LIB_CAPABILITY_VALUE: "retry-after, h429",
|
|
319
|
+
};
|
|
320
|
+
const Errors = {
|
|
321
|
+
INVALID_GRANT_ERROR: "invalid_grant",
|
|
322
|
+
CLIENT_MISMATCH_ERROR: "client_mismatch",
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* Password grant parameters
|
|
326
|
+
*/
|
|
327
|
+
var PasswordGrantConstants;
|
|
328
|
+
(function (PasswordGrantConstants) {
|
|
329
|
+
PasswordGrantConstants["username"] = "username";
|
|
330
|
+
PasswordGrantConstants["password"] = "password";
|
|
331
|
+
})(PasswordGrantConstants || (PasswordGrantConstants = {}));
|
|
332
|
+
/**
|
|
333
|
+
* Response codes
|
|
334
|
+
*/
|
|
335
|
+
var ResponseCodes;
|
|
336
|
+
(function (ResponseCodes) {
|
|
337
|
+
ResponseCodes[ResponseCodes["httpSuccess"] = 200] = "httpSuccess";
|
|
338
|
+
ResponseCodes[ResponseCodes["httpBadRequest"] = 400] = "httpBadRequest";
|
|
339
|
+
})(ResponseCodes || (ResponseCodes = {}));
|
|
340
|
+
/**
|
|
341
|
+
* Region Discovery Sources
|
|
342
|
+
*/
|
|
343
|
+
var RegionDiscoverySources;
|
|
344
|
+
(function (RegionDiscoverySources) {
|
|
345
|
+
RegionDiscoverySources["FAILED_AUTO_DETECTION"] = "1";
|
|
346
|
+
RegionDiscoverySources["INTERNAL_CACHE"] = "2";
|
|
347
|
+
RegionDiscoverySources["ENVIRONMENT_VARIABLE"] = "3";
|
|
348
|
+
RegionDiscoverySources["IMDS"] = "4";
|
|
349
|
+
})(RegionDiscoverySources || (RegionDiscoverySources = {}));
|
|
350
|
+
/**
|
|
351
|
+
* Region Discovery Outcomes
|
|
352
|
+
*/
|
|
353
|
+
var RegionDiscoveryOutcomes;
|
|
354
|
+
(function (RegionDiscoveryOutcomes) {
|
|
355
|
+
RegionDiscoveryOutcomes["CONFIGURED_MATCHES_DETECTED"] = "1";
|
|
356
|
+
RegionDiscoveryOutcomes["CONFIGURED_NO_AUTO_DETECTION"] = "2";
|
|
357
|
+
RegionDiscoveryOutcomes["CONFIGURED_NOT_DETECTED"] = "3";
|
|
358
|
+
RegionDiscoveryOutcomes["AUTO_DETECTION_REQUESTED_SUCCESSFUL"] = "4";
|
|
359
|
+
RegionDiscoveryOutcomes["AUTO_DETECTION_REQUESTED_FAILED"] = "5";
|
|
360
|
+
})(RegionDiscoveryOutcomes || (RegionDiscoveryOutcomes = {}));
|
|
361
|
+
var CacheOutcome;
|
|
362
|
+
(function (CacheOutcome) {
|
|
363
|
+
CacheOutcome["NO_CACHE_HIT"] = "0";
|
|
364
|
+
CacheOutcome["FORCE_REFRESH"] = "1";
|
|
365
|
+
CacheOutcome["NO_CACHED_ACCESS_TOKEN"] = "2";
|
|
366
|
+
CacheOutcome["CACHED_ACCESS_TOKEN_EXPIRED"] = "3";
|
|
367
|
+
CacheOutcome["REFRESH_CACHED_ACCESS_TOKEN"] = "4";
|
|
368
|
+
})(CacheOutcome || (CacheOutcome = {}));
|
|
369
|
+
var JsonTypes;
|
|
370
|
+
(function (JsonTypes) {
|
|
371
|
+
JsonTypes["Jwt"] = "JWT";
|
|
372
|
+
JsonTypes["Jwk"] = "JWK";
|
|
373
|
+
JsonTypes["Pop"] = "pop";
|
|
374
|
+
})(JsonTypes || (JsonTypes = {}));
|
|
375
375
|
const ONE_DAY_IN_MS = 86400000;
|
|
376
376
|
|
|
377
377
|
export { AADAuthorityConstants, AADServerParamKeys, APP_METADATA, AUTHORITY_METADATA_CONSTANTS, AuthenticationScheme, AuthorityMetadataSource, CLIENT_INFO, CacheAccountType, CacheOutcome, CacheType, ClaimsRequestKeys, CodeChallengeMethodValues, Constants, CredentialType, Errors, GrantType, HeaderNames, JsonTypes, OIDC_DEFAULT_SCOPES, OIDC_SCOPES, ONE_DAY_IN_MS, PasswordGrantConstants, PersistentCacheKeys, PromptValue, RegionDiscoveryOutcomes, RegionDiscoverySources, ResponseCodes, ResponseMode, SERVER_TELEM_CONSTANTS, SSOTypes, Separators, THE_FAMILY_ID, ThrottlingConstants };
|