@azure/msal-common 1.6.3 → 2.0.0
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/CHANGELOG.json +180 -0
- package/changelog.md +60 -6
- package/dist/index.es.js +1346 -1034
- package/dist/index.js +1050 -737
- package/dist/src/account/AccountInfo.d.ts +5 -0
- package/dist/src/authority/Authority.d.ts +8 -1
- package/dist/src/cache/CacheManager.d.ts +17 -2
- package/dist/src/cache/entities/AccountEntity.d.ts +15 -2
- package/dist/src/cache/entities/CacheRecord.d.ts +6 -6
- package/dist/src/client/AuthorizationCodeClient.d.ts +8 -2
- package/dist/src/client/BaseClient.d.ts +9 -4
- package/dist/src/client/ClientCredentialClient.d.ts +21 -1
- package/dist/src/client/DeviceCodeClient.d.ts +1 -1
- package/dist/src/client/OnBehalfOfClient.d.ts +30 -1
- package/dist/src/client/RefreshTokenClient.d.ts +2 -2
- package/dist/src/client/SilentFlowClient.d.ts +1 -1
- package/dist/src/client/UsernamePasswordClient.d.ts +28 -0
- package/dist/src/config/ClientConfiguration.d.ts +19 -6
- package/dist/src/error/AuthError.d.ts +2 -2
- package/dist/src/error/ClientAuthError.d.ts +45 -5
- package/dist/src/error/ClientConfigurationError.d.ts +8 -0
- package/dist/src/error/InteractionRequiredAuthError.d.ts +2 -2
- package/dist/src/error/ServerError.d.ts +1 -2
- package/dist/src/index.d.ts +4 -0
- package/dist/src/logger/Logger.d.ts +7 -1
- package/dist/src/request/AuthorizationCodeRequest.d.ts +2 -2
- package/dist/src/request/AuthorizationUrlRequest.d.ts +9 -9
- package/dist/src/request/BaseAuthRequest.d.ts +2 -2
- package/dist/src/request/ClientCredentialRequest.d.ts +1 -1
- package/dist/src/request/EndSessionRequest.d.ts +3 -3
- package/dist/src/request/RefreshTokenRequest.d.ts +1 -1
- package/dist/src/request/RequestParameterBuilder.d.ts +22 -2
- package/dist/src/request/SilentFlowRequest.d.ts +1 -1
- package/dist/src/request/UsernamePasswordRequest.d.ts +16 -0
- package/dist/src/response/AuthenticationResult.d.ts +5 -2
- package/dist/src/response/AuthorizationCodePayload.d.ts +12 -0
- package/dist/src/response/ResponseHandler.d.ts +4 -4
- package/dist/src/response/ServerAuthorizationCodeResponse.d.ts +4 -0
- package/dist/src/url/UrlString.d.ts +1 -0
- package/dist/src/utils/Constants.d.ts +9 -0
- package/dist/src/utils/StringUtils.d.ts +8 -2
- package/package.json +4 -3
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
* - resourceRequestUri - URI that token will be used for. Used for proof-of-possession flows.
|
|
9
9
|
*/
|
|
10
10
|
export declare type BaseAuthRequest = {
|
|
11
|
+
authority: string;
|
|
12
|
+
correlationId: string;
|
|
11
13
|
scopes: Array<string>;
|
|
12
14
|
claims?: string;
|
|
13
|
-
authority?: string;
|
|
14
|
-
correlationId?: string;
|
|
15
15
|
resourceRequestMethod?: string;
|
|
16
16
|
resourceRequestUri?: string;
|
|
17
17
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseAuthRequest } from "./BaseAuthRequest";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* ClientCredentialRequest
|
|
4
4
|
* - scopes - Array of scopes the application is requesting access to.
|
|
5
5
|
* - authority - URL of the authority, the security token service (STS) from which MSAL will acquire tokens.
|
|
6
6
|
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
@@ -3,12 +3,12 @@ import { AccountInfo } from "../account/AccountInfo";
|
|
|
3
3
|
* EndSessionRequest
|
|
4
4
|
* - account - Account object that will be logged out of. All tokens tied to this account will be cleared.
|
|
5
5
|
* - postLogoutRedirectUri - URI to navigate to after logout page.
|
|
6
|
-
* - authority - Authority to send logout request to.
|
|
7
6
|
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
7
|
+
* - idTokenHint - ID Token used by B2C to validate logout if required by the policy
|
|
8
8
|
*/
|
|
9
9
|
export declare type EndSessionRequest = {
|
|
10
|
+
correlationId: string;
|
|
10
11
|
account?: AccountInfo;
|
|
11
12
|
postLogoutRedirectUri?: string;
|
|
12
|
-
|
|
13
|
-
correlationId?: string;
|
|
13
|
+
idTokenHint?: string;
|
|
14
14
|
};
|
|
@@ -29,6 +29,16 @@ export declare class RequestParameterBuilder {
|
|
|
29
29
|
* @param redirectUri
|
|
30
30
|
*/
|
|
31
31
|
addRedirectUri(redirectUri: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* add post logout redirectUri
|
|
34
|
+
* @param redirectUri
|
|
35
|
+
*/
|
|
36
|
+
addPostLogoutRedirectUri(redirectUri: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* add id_token_hint to logout request
|
|
39
|
+
* @param idTokenHint
|
|
40
|
+
*/
|
|
41
|
+
addIdTokenHint(idTokenHint: string): void;
|
|
32
42
|
/**
|
|
33
43
|
* add domain_hint
|
|
34
44
|
* @param domainHint
|
|
@@ -48,7 +58,7 @@ export declare class RequestParameterBuilder {
|
|
|
48
58
|
* add claims
|
|
49
59
|
* @param claims
|
|
50
60
|
*/
|
|
51
|
-
addClaims(claims
|
|
61
|
+
addClaims(claims?: string, clientCapabilities?: Array<string>): void;
|
|
52
62
|
/**
|
|
53
63
|
* add correlationId
|
|
54
64
|
* @param correlationId
|
|
@@ -141,7 +151,17 @@ export declare class RequestParameterBuilder {
|
|
|
141
151
|
* @param eQparams
|
|
142
152
|
*/
|
|
143
153
|
addExtraQueryParameters(eQparams: StringDict): void;
|
|
144
|
-
addClientCapabilitiesToClaims(claims
|
|
154
|
+
addClientCapabilitiesToClaims(claims?: string, clientCapabilities?: Array<string>): string;
|
|
155
|
+
/**
|
|
156
|
+
* adds `username` for Password Grant flow
|
|
157
|
+
* @param username
|
|
158
|
+
*/
|
|
159
|
+
addUsername(username: string): void;
|
|
160
|
+
/**
|
|
161
|
+
* adds `password` for Password Grant flow
|
|
162
|
+
* @param password
|
|
163
|
+
*/
|
|
164
|
+
addPassword(password: string): void;
|
|
145
165
|
/**
|
|
146
166
|
* add pop_jwk to query params
|
|
147
167
|
* @param cnfString
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseAuthRequest } from "./BaseAuthRequest";
|
|
2
|
+
/**
|
|
3
|
+
* UsernamePassword parameters passed by the user to retrieve credentials
|
|
4
|
+
* Note: The latest OAuth 2.0 Security Best Current Practice disallows the password grant entirely. This flow is added for internal testing.
|
|
5
|
+
*
|
|
6
|
+
* - scopes - Array of scopes the application is requesting access to.
|
|
7
|
+
* - claims - A stringified claims request which will be added to all /authorize and /token calls. When included on a silent request, cache lookup will be skipped and token will be refreshed.
|
|
8
|
+
* - authority - Url of the authority which the application acquires tokens from.
|
|
9
|
+
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
10
|
+
* - username - username of the client
|
|
11
|
+
* - password - credentials
|
|
12
|
+
*/
|
|
13
|
+
export declare type UsernamePasswordRequest = BaseAuthRequest & {
|
|
14
|
+
username: string;
|
|
15
|
+
password: string;
|
|
16
|
+
};
|
|
@@ -15,17 +15,20 @@ import { AccountInfo } from "../account/AccountInfo";
|
|
|
15
15
|
* - familyId - Family ID identifier, usually only used for refresh tokens
|
|
16
16
|
*/
|
|
17
17
|
export declare type AuthenticationResult = {
|
|
18
|
+
authority: string;
|
|
18
19
|
uniqueId: string;
|
|
19
20
|
tenantId: string;
|
|
20
21
|
scopes: Array<string>;
|
|
21
|
-
account: AccountInfo;
|
|
22
|
+
account: AccountInfo | null;
|
|
22
23
|
idToken: string;
|
|
23
24
|
idTokenClaims: object;
|
|
24
25
|
accessToken: string;
|
|
25
26
|
fromCache: boolean;
|
|
26
|
-
expiresOn: Date;
|
|
27
|
+
expiresOn: Date | null;
|
|
27
28
|
tokenType: string;
|
|
28
29
|
extExpiresOn?: Date;
|
|
29
30
|
state?: string;
|
|
30
31
|
familyId?: string;
|
|
32
|
+
cloudGraphHostName?: string;
|
|
33
|
+
msGraphHost?: string;
|
|
31
34
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response returned after processing the code response query string or fragment.
|
|
3
|
+
*/
|
|
4
|
+
export declare type AuthorizationCodePayload = {
|
|
5
|
+
code: string;
|
|
6
|
+
cloud_instance_name?: string;
|
|
7
|
+
cloud_instance_host_name?: string;
|
|
8
|
+
cloud_graph_host_name?: string;
|
|
9
|
+
msgraph_host?: string;
|
|
10
|
+
state?: string;
|
|
11
|
+
nonce?: string;
|
|
12
|
+
};
|
|
@@ -10,6 +10,7 @@ import { CacheManager } from "../cache/CacheManager";
|
|
|
10
10
|
import { RequestStateObject } from "../utils/ProtocolUtils";
|
|
11
11
|
import { ICachePlugin } from "../cache/interface/ICachePlugin";
|
|
12
12
|
import { ISerializableTokenCache } from "../cache/interface/ISerializableTokenCache";
|
|
13
|
+
import { AuthorizationCodePayload } from "./AuthorizationCodePayload";
|
|
13
14
|
/**
|
|
14
15
|
* Class that handles response parsing.
|
|
15
16
|
*/
|
|
@@ -18,11 +19,10 @@ export declare class ResponseHandler {
|
|
|
18
19
|
private cacheStorage;
|
|
19
20
|
private cryptoObj;
|
|
20
21
|
private logger;
|
|
21
|
-
private clientInfo;
|
|
22
22
|
private homeAccountIdentifier;
|
|
23
23
|
private serializableCache;
|
|
24
24
|
private persistencePlugin;
|
|
25
|
-
constructor(clientId: string, cacheStorage: CacheManager, cryptoObj: ICrypto, logger: Logger, serializableCache
|
|
25
|
+
constructor(clientId: string, cacheStorage: CacheManager, cryptoObj: ICrypto, logger: Logger, serializableCache: ISerializableTokenCache | null, persistencePlugin: ICachePlugin | null);
|
|
26
26
|
/**
|
|
27
27
|
* Function which validates server authorization code response.
|
|
28
28
|
* @param serverResponseHash
|
|
@@ -40,7 +40,7 @@ export declare class ResponseHandler {
|
|
|
40
40
|
* @param serverTokenResponse
|
|
41
41
|
* @param authority
|
|
42
42
|
*/
|
|
43
|
-
handleServerTokenResponse(serverTokenResponse: ServerAuthorizationTokenResponse, authority: Authority, resourceRequestMethod?: string, resourceRequestUri?: string,
|
|
43
|
+
handleServerTokenResponse(serverTokenResponse: ServerAuthorizationTokenResponse, authority: Authority, resourceRequestMethod?: string, resourceRequestUri?: string, authCodePayload?: AuthorizationCodePayload, requestScopes?: string[], oboAssertion?: string, handlingRefreshTokenResponse?: boolean): Promise<AuthenticationResult | null>;
|
|
44
44
|
/**
|
|
45
45
|
* Generates CacheRecord
|
|
46
46
|
* @param serverTokenResponse
|
|
@@ -65,5 +65,5 @@ export declare class ResponseHandler {
|
|
|
65
65
|
* @param fromTokenCache
|
|
66
66
|
* @param stateString
|
|
67
67
|
*/
|
|
68
|
-
static generateAuthenticationResult(cryptoObj: ICrypto,
|
|
68
|
+
static generateAuthenticationResult(cryptoObj: ICrypto, authority: Authority, cacheRecord: CacheRecord, fromTokenCache: boolean, idTokenObj?: AuthToken, requestState?: RequestStateObject, resourceRequestMethod?: string, resourceRequestUri?: string): Promise<AuthenticationResult>;
|
|
69
69
|
}
|
|
@@ -10,6 +10,10 @@ export declare type ServerAuthorizationCodeResponse = {
|
|
|
10
10
|
code?: string;
|
|
11
11
|
client_info?: string;
|
|
12
12
|
state?: string;
|
|
13
|
+
cloud_instance_name?: string;
|
|
14
|
+
cloud_instance_host_name?: string;
|
|
15
|
+
cloud_graph_host_name?: string;
|
|
16
|
+
msgraph_host?: string;
|
|
13
17
|
error?: string;
|
|
14
18
|
error_description?: string;
|
|
15
19
|
suberror?: string;
|
|
@@ -39,6 +39,7 @@ export declare class UrlString {
|
|
|
39
39
|
*/
|
|
40
40
|
getUrlComponents(): IUri;
|
|
41
41
|
static getDomainFromUrl(url: string): string;
|
|
42
|
+
static getAbsoluteUrl(relativeUrl: string, baseUrl: string): string;
|
|
42
43
|
/**
|
|
43
44
|
* Parses hash string from given string. Returns empty string if no hash symbol is found.
|
|
44
45
|
* @param hashString
|
|
@@ -22,6 +22,7 @@ export declare const Constants: {
|
|
|
22
22
|
AUTHORIZATION_PENDING: string;
|
|
23
23
|
NOT_DEFINED: string;
|
|
24
24
|
EMPTY_STRING: string;
|
|
25
|
+
FORWARD_SLASH: string;
|
|
25
26
|
};
|
|
26
27
|
/**
|
|
27
28
|
* Request header names
|
|
@@ -84,6 +85,7 @@ export declare enum AADServerParamKeys {
|
|
|
84
85
|
X_CLIENT_OS = "x-client-OS",
|
|
85
86
|
X_CLIENT_CPU = "x-client-CPU",
|
|
86
87
|
POST_LOGOUT_URI = "post_logout_redirect_uri",
|
|
88
|
+
ID_TOKEN_HINT = "id_token_hint",
|
|
87
89
|
DEVICE_CODE = "device_code",
|
|
88
90
|
CLIENT_SECRET = "client_secret",
|
|
89
91
|
CLIENT_ASSERTION = "client_assertion",
|
|
@@ -252,3 +254,10 @@ export declare const Errors: {
|
|
|
252
254
|
INVALID_GRANT_ERROR: string;
|
|
253
255
|
CLIENT_MISMATCH_ERROR: string;
|
|
254
256
|
};
|
|
257
|
+
/**
|
|
258
|
+
* Password grant parameters
|
|
259
|
+
*/
|
|
260
|
+
export declare enum PasswordGrantConstants {
|
|
261
|
+
username = "username",
|
|
262
|
+
password = "password"
|
|
263
|
+
}
|
|
@@ -14,7 +14,7 @@ export declare class StringUtils {
|
|
|
14
14
|
*
|
|
15
15
|
* @param str
|
|
16
16
|
*/
|
|
17
|
-
static isEmpty(str
|
|
17
|
+
static isEmpty(str?: string): boolean;
|
|
18
18
|
static startsWith(str: string, search: string): boolean;
|
|
19
19
|
static endsWith(str: string, search: string): boolean;
|
|
20
20
|
/**
|
|
@@ -38,5 +38,11 @@ export declare class StringUtils {
|
|
|
38
38
|
* Attempts to parse a string into JSON
|
|
39
39
|
* @param str
|
|
40
40
|
*/
|
|
41
|
-
static jsonParseHelper<T>(str: string): T;
|
|
41
|
+
static jsonParseHelper<T>(str: string): T | null;
|
|
42
|
+
/**
|
|
43
|
+
* Tests if a given string matches a given pattern, with support for wildcards.
|
|
44
|
+
* @param pattern Wildcard pattern to string match. Supports "*" for wildcards
|
|
45
|
+
* @param input String to match against
|
|
46
|
+
*/
|
|
47
|
+
static matchPattern(pattern: string, input: string): boolean;
|
|
42
48
|
}
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
|
|
12
12
|
},
|
|
13
|
-
"version": "
|
|
13
|
+
"version": "2.0.0",
|
|
14
14
|
"description": "Microsoft Authentication Library for js",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"implicit",
|
|
@@ -48,11 +48,12 @@
|
|
|
48
48
|
"lint": "cd ../../ && npm run lint:common",
|
|
49
49
|
"lint:fix": "npm run lint -- -- --fix",
|
|
50
50
|
"test": "mocha",
|
|
51
|
-
"test:coverage": "nyc
|
|
51
|
+
"test:coverage": "nyc mocha",
|
|
52
52
|
"test:coverage:only": "npm run clean:coverage && npm run test:coverage",
|
|
53
53
|
"build:modules": "rollup -c",
|
|
54
54
|
"build:modules:watch": "rollup -cw",
|
|
55
55
|
"build": "npm run clean && npm run build:modules",
|
|
56
|
+
"build:all": "npm run build",
|
|
56
57
|
"prepack": "npm run build"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
"gh-pages": "^3.1.0",
|
|
78
79
|
"husky": "^3.0.9",
|
|
79
80
|
"mocha": "^6.2.2",
|
|
80
|
-
"nyc": "^
|
|
81
|
+
"nyc": "^15.0.0",
|
|
81
82
|
"rimraf": "^3.0.2",
|
|
82
83
|
"rollup": "^1.24.0",
|
|
83
84
|
"rollup-plugin-typescript2": "^0.24.3",
|