@azure/msal-common 1.7.2 → 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.
Files changed (40) hide show
  1. package/CHANGELOG.json +93 -0
  2. package/changelog.md +27 -4
  3. package/dist/index.es.js +1170 -1082
  4. package/dist/index.js +857 -769
  5. package/dist/src/account/AccountInfo.d.ts +3 -0
  6. package/dist/src/authority/Authority.d.ts +8 -1
  7. package/dist/src/cache/CacheManager.d.ts +5 -1
  8. package/dist/src/cache/entities/AccountEntity.d.ts +7 -2
  9. package/dist/src/cache/entities/CacheRecord.d.ts +6 -6
  10. package/dist/src/client/AuthorizationCodeClient.d.ts +8 -2
  11. package/dist/src/client/BaseClient.d.ts +9 -4
  12. package/dist/src/client/ClientCredentialClient.d.ts +21 -1
  13. package/dist/src/client/DeviceCodeClient.d.ts +1 -1
  14. package/dist/src/client/OnBehalfOfClient.d.ts +30 -1
  15. package/dist/src/client/RefreshTokenClient.d.ts +2 -2
  16. package/dist/src/client/SilentFlowClient.d.ts +1 -1
  17. package/dist/src/client/UsernamePasswordClient.d.ts +1 -1
  18. package/dist/src/config/ClientConfiguration.d.ts +19 -6
  19. package/dist/src/error/AuthError.d.ts +2 -2
  20. package/dist/src/error/ClientAuthError.d.ts +35 -1
  21. package/dist/src/error/ClientConfigurationError.d.ts +8 -0
  22. package/dist/src/error/InteractionRequiredAuthError.d.ts +2 -2
  23. package/dist/src/error/ServerError.d.ts +1 -2
  24. package/dist/src/index.d.ts +2 -0
  25. package/dist/src/logger/Logger.d.ts +7 -1
  26. package/dist/src/request/AuthorizationCodeRequest.d.ts +2 -2
  27. package/dist/src/request/AuthorizationUrlRequest.d.ts +9 -9
  28. package/dist/src/request/BaseAuthRequest.d.ts +2 -2
  29. package/dist/src/request/ClientCredentialRequest.d.ts +1 -1
  30. package/dist/src/request/EndSessionRequest.d.ts +3 -3
  31. package/dist/src/request/RefreshTokenRequest.d.ts +1 -1
  32. package/dist/src/request/RequestParameterBuilder.d.ts +12 -2
  33. package/dist/src/request/SilentFlowRequest.d.ts +1 -1
  34. package/dist/src/response/AuthenticationResult.d.ts +5 -2
  35. package/dist/src/response/AuthorizationCodePayload.d.ts +12 -0
  36. package/dist/src/response/ResponseHandler.d.ts +4 -3
  37. package/dist/src/response/ServerAuthorizationCodeResponse.d.ts +4 -0
  38. package/dist/src/utils/Constants.d.ts +1 -0
  39. package/dist/src/utils/StringUtils.d.ts +8 -2
  40. package/package.json +1 -1
@@ -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
  */
@@ -21,7 +22,7 @@ export declare class ResponseHandler {
21
22
  private homeAccountIdentifier;
22
23
  private serializableCache;
23
24
  private persistencePlugin;
24
- constructor(clientId: string, cacheStorage: CacheManager, cryptoObj: ICrypto, logger: Logger, serializableCache?: ISerializableTokenCache, persistencePlugin?: ICachePlugin);
25
+ constructor(clientId: string, cacheStorage: CacheManager, cryptoObj: ICrypto, logger: Logger, serializableCache: ISerializableTokenCache | null, persistencePlugin: ICachePlugin | null);
25
26
  /**
26
27
  * Function which validates server authorization code response.
27
28
  * @param serverResponseHash
@@ -39,7 +40,7 @@ export declare class ResponseHandler {
39
40
  * @param serverTokenResponse
40
41
  * @param authority
41
42
  */
42
- handleServerTokenResponse(serverTokenResponse: ServerAuthorizationTokenResponse, authority: Authority, resourceRequestMethod?: string, resourceRequestUri?: string, cachedNonce?: string, cachedState?: string, requestScopes?: string[], oboAssertion?: string, handlingRefreshTokenResponse?: boolean): Promise<AuthenticationResult>;
43
+ handleServerTokenResponse(serverTokenResponse: ServerAuthorizationTokenResponse, authority: Authority, resourceRequestMethod?: string, resourceRequestUri?: string, authCodePayload?: AuthorizationCodePayload, requestScopes?: string[], oboAssertion?: string, handlingRefreshTokenResponse?: boolean): Promise<AuthenticationResult | null>;
43
44
  /**
44
45
  * Generates CacheRecord
45
46
  * @param serverTokenResponse
@@ -64,5 +65,5 @@ export declare class ResponseHandler {
64
65
  * @param fromTokenCache
65
66
  * @param stateString
66
67
  */
67
- static generateAuthenticationResult(cryptoObj: ICrypto, cacheRecord: CacheRecord, idTokenObj: AuthToken, fromTokenCache: boolean, requestState?: RequestStateObject, resourceRequestMethod?: string, resourceRequestUri?: string): Promise<AuthenticationResult>;
68
+ static generateAuthenticationResult(cryptoObj: ICrypto, authority: Authority, cacheRecord: CacheRecord, fromTokenCache: boolean, idTokenObj?: AuthToken, requestState?: RequestStateObject, resourceRequestMethod?: string, resourceRequestUri?: string): Promise<AuthenticationResult>;
68
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;
@@ -85,6 +85,7 @@ export declare enum AADServerParamKeys {
85
85
  X_CLIENT_OS = "x-client-OS",
86
86
  X_CLIENT_CPU = "x-client-CPU",
87
87
  POST_LOGOUT_URI = "post_logout_redirect_uri",
88
+ ID_TOKEN_HINT = "id_token_hint",
88
89
  DEVICE_CODE = "device_code",
89
90
  CLIENT_SECRET = "client_secret",
90
91
  CLIENT_ASSERTION = "client_assertion",
@@ -14,7 +14,7 @@ export declare class StringUtils {
14
14
  *
15
15
  * @param str
16
16
  */
17
- static isEmpty(str: string): boolean;
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": "1.7.2",
13
+ "version": "2.0.0",
14
14
  "description": "Microsoft Authentication Library for js",
15
15
  "keywords": [
16
16
  "implicit",