@azure/msal-common 14.6.0 → 14.6.2-alpha.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 (106) hide show
  1. package/dist/account/AccountInfo.mjs +1 -1
  2. package/dist/account/AuthToken.mjs +1 -1
  3. package/dist/account/CcsCredential.mjs +1 -1
  4. package/dist/account/ClientInfo.mjs +1 -1
  5. package/dist/account/TokenClaims.mjs +1 -1
  6. package/dist/authority/Authority.d.ts +2 -2
  7. package/dist/authority/Authority.d.ts.map +1 -1
  8. package/dist/authority/Authority.mjs +8 -4
  9. package/dist/authority/Authority.mjs.map +1 -1
  10. package/dist/authority/AuthorityFactory.d.ts +12 -25
  11. package/dist/authority/AuthorityFactory.d.ts.map +1 -1
  12. package/dist/authority/AuthorityFactory.mjs +23 -44
  13. package/dist/authority/AuthorityFactory.mjs.map +1 -1
  14. package/dist/authority/AuthorityMetadata.d.ts +9 -469
  15. package/dist/authority/AuthorityMetadata.d.ts.map +1 -1
  16. package/dist/authority/AuthorityMetadata.mjs +16 -482
  17. package/dist/authority/AuthorityMetadata.mjs.map +1 -1
  18. package/dist/authority/AuthorityOptions.mjs +1 -1
  19. package/dist/authority/AuthorityType.mjs +1 -1
  20. package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
  21. package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
  22. package/dist/authority/OpenIdConfigResponse.mjs +1 -1
  23. package/dist/authority/ProtocolMode.mjs +1 -1
  24. package/dist/authority/RegionDiscovery.mjs +1 -1
  25. package/dist/cache/CacheManager.mjs +1 -1
  26. package/dist/cache/entities/AccountEntity.mjs +1 -1
  27. package/dist/cache/entities/CacheRecord.mjs +1 -1
  28. package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
  29. package/dist/cache/utils/CacheHelpers.mjs +5 -5
  30. package/dist/cache/utils/CacheHelpers.mjs.map +1 -1
  31. package/dist/client/AuthorizationCodeClient.mjs +3 -3
  32. package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
  33. package/dist/client/BaseClient.d.ts.map +1 -1
  34. package/dist/client/BaseClient.mjs +3 -3
  35. package/dist/client/BaseClient.mjs.map +1 -1
  36. package/dist/client/RefreshTokenClient.mjs +4 -4
  37. package/dist/client/RefreshTokenClient.mjs.map +1 -1
  38. package/dist/client/SilentFlowClient.mjs +5 -5
  39. package/dist/client/SilentFlowClient.mjs.map +1 -1
  40. package/dist/config/ClientConfiguration.mjs +1 -1
  41. package/dist/constants/AADServerParamKeys.mjs +1 -1
  42. package/dist/crypto/ICrypto.mjs +1 -1
  43. package/dist/crypto/JoseHeader.mjs +1 -1
  44. package/dist/crypto/PopTokenGenerator.mjs +3 -3
  45. package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
  46. package/dist/error/AuthError.mjs +1 -1
  47. package/dist/error/AuthErrorCodes.mjs +1 -1
  48. package/dist/error/ClientAuthError.mjs +1 -1
  49. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  50. package/dist/error/ClientConfigurationError.mjs +1 -1
  51. package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
  52. package/dist/error/InteractionRequiredAuthError.mjs +1 -1
  53. package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
  54. package/dist/error/JoseHeaderError.mjs +1 -1
  55. package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
  56. package/dist/error/ServerError.mjs +1 -1
  57. package/dist/index.cjs +116 -576
  58. package/dist/index.cjs.map +1 -1
  59. package/dist/index.d.ts +2 -2
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.mjs +5 -3
  62. package/dist/index.mjs.map +1 -1
  63. package/dist/logger/Logger.mjs +1 -1
  64. package/dist/network/INetworkModule.mjs +1 -1
  65. package/dist/network/NetworkManager.mjs +1 -1
  66. package/dist/network/ThrottlingUtils.mjs +1 -1
  67. package/dist/packageMetadata.d.ts +1 -1
  68. package/dist/packageMetadata.d.ts.map +1 -1
  69. package/dist/packageMetadata.mjs +2 -2
  70. package/dist/request/AuthenticationHeaderParser.mjs +1 -1
  71. package/dist/request/RequestParameterBuilder.mjs +1 -1
  72. package/dist/request/RequestValidator.mjs +1 -1
  73. package/dist/request/ScopeSet.mjs +1 -1
  74. package/dist/response/ResponseHandler.mjs +2 -2
  75. package/dist/response/ResponseHandler.mjs.map +1 -1
  76. package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
  77. package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
  78. package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
  79. package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
  80. package/dist/url/UrlString.mjs +1 -1
  81. package/dist/utils/Constants.mjs +1 -1
  82. package/dist/utils/FunctionWrappers.d.ts.map +1 -1
  83. package/dist/utils/FunctionWrappers.mjs +11 -1
  84. package/dist/utils/FunctionWrappers.mjs.map +1 -1
  85. package/dist/utils/ProtocolUtils.mjs +1 -1
  86. package/dist/utils/StringUtils.mjs +1 -1
  87. package/dist/utils/TimeUtils.d.ts +23 -25
  88. package/dist/utils/TimeUtils.d.ts.map +1 -1
  89. package/dist/utils/TimeUtils.mjs +38 -40
  90. package/dist/utils/TimeUtils.mjs.map +1 -1
  91. package/dist/utils/UrlUtils.mjs +1 -1
  92. package/package.json +3 -3
  93. package/src/authority/Authority.ts +12 -5
  94. package/src/authority/AuthorityFactory.ts +48 -92
  95. package/src/authority/AuthorityMetadata.ts +23 -526
  96. package/src/cache/utils/CacheHelpers.ts +1 -1
  97. package/src/client/AuthorizationCodeClient.ts +1 -1
  98. package/src/client/BaseClient.ts +10 -11
  99. package/src/client/RefreshTokenClient.ts +1 -1
  100. package/src/client/SilentFlowClient.ts +1 -1
  101. package/src/crypto/PopTokenGenerator.ts +1 -1
  102. package/src/index.ts +2 -2
  103. package/src/packageMetadata.ts +1 -1
  104. package/src/response/ResponseHandler.ts +1 -1
  105. package/src/utils/FunctionWrappers.ts +16 -0
  106. package/src/utils/TimeUtils.ts +37 -38
@@ -4,10 +4,6 @@
4
4
  */
5
5
 
6
6
  import { Authority, formatAuthorityUri } from "./Authority";
7
- import {
8
- createClientConfigurationError,
9
- ClientConfigurationErrorCodes,
10
- } from "../error/ClientConfigurationError";
11
7
  import { INetworkModule } from "../network/INetworkModule";
12
8
  import {
13
9
  createClientAuthError,
@@ -20,99 +16,59 @@ import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient"
20
16
  import { PerformanceEvents } from "../telemetry/performance/PerformanceEvent";
21
17
  import { invokeAsync } from "../utils/FunctionWrappers";
22
18
 
23
- /** @internal */
24
- export class AuthorityFactory {
25
- /**
26
- * Create an authority object of the correct type based on the url
27
- * Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)
28
- *
29
- * Also performs endpoint discovery.
30
- *
31
- * @param authorityUri
32
- * @param networkClient
33
- * @param protocolMode
34
- */
35
- static async createDiscoveredInstance(
36
- authorityUri: string,
37
- networkClient: INetworkModule,
38
- cacheManager: ICacheManager,
39
- authorityOptions: AuthorityOptions,
40
- logger: Logger,
41
- performanceClient?: IPerformanceClient,
42
- correlationId?: string
43
- ): Promise<Authority> {
44
- performanceClient?.addQueueMeasurement(
45
- PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance,
46
- correlationId
47
- );
48
- const authorityUriFinal = Authority.transformCIAMAuthority(
49
- formatAuthorityUri(authorityUri)
50
- );
51
-
52
- // Initialize authority and perform discovery endpoint check.
53
- const acquireTokenAuthority: Authority =
54
- AuthorityFactory.createInstance(
55
- authorityUriFinal,
56
- networkClient,
57
- cacheManager,
58
- authorityOptions,
59
- logger,
60
- performanceClient,
61
- correlationId
62
- );
63
-
64
- try {
65
- await invokeAsync(
66
- acquireTokenAuthority.resolveEndpointsAsync.bind(
67
- acquireTokenAuthority
68
- ),
69
- PerformanceEvents.AuthorityResolveEndpointsAsync,
70
- logger,
71
- performanceClient,
72
- correlationId
73
- )();
74
- return acquireTokenAuthority;
75
- } catch (e) {
76
- throw createClientAuthError(
77
- ClientAuthErrorCodes.endpointResolutionError
78
- );
79
- }
80
- }
19
+ /**
20
+ * Create an authority object of the correct type based on the url
21
+ * Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)
22
+ *
23
+ * Also performs endpoint discovery.
24
+ *
25
+ * @param authorityUri
26
+ * @param networkClient
27
+ * @param protocolMode
28
+ * @internal
29
+ */
30
+ export async function createDiscoveredInstance(
31
+ authorityUri: string,
32
+ networkClient: INetworkModule,
33
+ cacheManager: ICacheManager,
34
+ authorityOptions: AuthorityOptions,
35
+ logger: Logger,
36
+ correlationId: string,
37
+ performanceClient?: IPerformanceClient
38
+ ): Promise<Authority> {
39
+ performanceClient?.addQueueMeasurement(
40
+ PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance,
41
+ correlationId
42
+ );
43
+ const authorityUriFinal = Authority.transformCIAMAuthority(
44
+ formatAuthorityUri(authorityUri)
45
+ );
81
46
 
82
- /**
83
- * Create an authority object of the correct type based on the url
84
- * Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)
85
- *
86
- * Does not perform endpoint discovery.
87
- *
88
- * @param authorityUrl
89
- * @param networkInterface
90
- * @param protocolMode
91
- */
92
- static createInstance(
93
- authorityUrl: string,
94
- networkInterface: INetworkModule,
95
- cacheManager: ICacheManager,
96
- authorityOptions: AuthorityOptions,
97
- logger: Logger,
98
- performanceClient?: IPerformanceClient,
99
- correlationId?: string
100
- ): Authority {
101
- // Throw error if authority url is empty
102
- if (!authorityUrl) {
103
- throw createClientConfigurationError(
104
- ClientConfigurationErrorCodes.urlEmptyError
105
- );
106
- }
47
+ // Initialize authority and perform discovery endpoint check.
48
+ const acquireTokenAuthority: Authority = new Authority(
49
+ authorityUriFinal,
50
+ networkClient,
51
+ cacheManager,
52
+ authorityOptions,
53
+ logger,
54
+ correlationId,
55
+ performanceClient
56
+ );
107
57
 
108
- return new Authority(
109
- authorityUrl,
110
- networkInterface,
111
- cacheManager,
112
- authorityOptions,
58
+ try {
59
+ await invokeAsync(
60
+ acquireTokenAuthority.resolveEndpointsAsync.bind(
61
+ acquireTokenAuthority
62
+ ),
63
+ PerformanceEvents.AuthorityResolveEndpointsAsync,
113
64
  logger,
114
65
  performanceClient,
115
66
  correlationId
67
+ )();
68
+ return acquireTokenAuthority;
69
+ } catch (e) {
70
+ throw createClientAuthError(
71
+ ClientAuthErrorCodes.endpointResolutionError
116
72
  );
117
73
  }
118
74
  }