@azure/msal-node 1.17.2 → 2.0.0-alpha.1

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 (177) hide show
  1. package/README.md +1 -0
  2. package/dist/cache/ITokenCache.d.ts.map +1 -1
  3. package/dist/cache/NodeStorage.d.ts.map +1 -1
  4. package/dist/cache/NodeStorage.esm.js +410 -0
  5. package/dist/cache/NodeStorage.esm.js.map +1 -0
  6. package/dist/cache/NodeStorage.js +412 -0
  7. package/dist/cache/NodeStorage.js.map +1 -0
  8. package/dist/cache/TokenCache.d.ts.map +1 -1
  9. package/dist/cache/TokenCache.esm.js +278 -0
  10. package/dist/cache/TokenCache.esm.js.map +1 -0
  11. package/dist/cache/TokenCache.js +280 -0
  12. package/dist/cache/TokenCache.js.map +1 -0
  13. package/dist/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  14. package/dist/cache/distributed/DistributedCachePlugin.esm.js +33 -0
  15. package/dist/cache/distributed/DistributedCachePlugin.esm.js.map +1 -0
  16. package/dist/cache/distributed/DistributedCachePlugin.js +35 -0
  17. package/dist/cache/distributed/DistributedCachePlugin.js.map +1 -0
  18. package/dist/cache/distributed/ICacheClient.d.ts.map +1 -1
  19. package/dist/cache/distributed/IPartitionManager.d.ts.map +1 -1
  20. package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
  21. package/dist/cache/serializer/Deserializer.esm.js +182 -0
  22. package/dist/cache/serializer/Deserializer.esm.js.map +1 -0
  23. package/dist/cache/serializer/Deserializer.js +184 -0
  24. package/dist/cache/serializer/Deserializer.js.map +1 -0
  25. package/dist/cache/serializer/Serializer.d.ts.map +1 -1
  26. package/dist/cache/serializer/Serializer.esm.js +139 -0
  27. package/dist/cache/serializer/Serializer.esm.js.map +1 -0
  28. package/dist/cache/serializer/Serializer.js +141 -0
  29. package/dist/cache/serializer/Serializer.js.map +1 -0
  30. package/dist/cache/serializer/SerializerTypes.d.ts +8 -8
  31. package/dist/cache/serializer/SerializerTypes.d.ts.map +1 -1
  32. package/dist/client/ClientApplication.d.ts +1 -1
  33. package/dist/client/ClientApplication.d.ts.map +1 -1
  34. package/dist/client/ClientApplication.esm.js +342 -0
  35. package/dist/client/ClientApplication.esm.js.map +1 -0
  36. package/dist/client/ClientApplication.js +344 -0
  37. package/dist/client/ClientApplication.js.map +1 -0
  38. package/dist/client/ClientAssertion.d.ts.map +1 -1
  39. package/dist/client/ClientAssertion.esm.js +126 -0
  40. package/dist/client/ClientAssertion.esm.js.map +1 -0
  41. package/dist/client/ClientAssertion.js +128 -0
  42. package/dist/client/ClientAssertion.js.map +1 -0
  43. package/dist/client/ClientCredentialClient.d.ts +34 -0
  44. package/dist/client/ClientCredentialClient.d.ts.map +1 -0
  45. package/dist/client/ClientCredentialClient.esm.js +164 -0
  46. package/dist/client/ClientCredentialClient.esm.js.map +1 -0
  47. package/dist/client/ClientCredentialClient.js +166 -0
  48. package/dist/client/ClientCredentialClient.js.map +1 -0
  49. package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
  50. package/dist/client/ConfidentialClientApplication.esm.js +175 -0
  51. package/dist/client/ConfidentialClientApplication.esm.js.map +1 -0
  52. package/dist/client/ConfidentialClientApplication.js +177 -0
  53. package/dist/client/ConfidentialClientApplication.js.map +1 -0
  54. package/dist/client/DeviceCodeClient.d.ts +54 -0
  55. package/dist/client/DeviceCodeClient.d.ts.map +1 -0
  56. package/dist/client/DeviceCodeClient.esm.js +214 -0
  57. package/dist/client/DeviceCodeClient.esm.js.map +1 -0
  58. package/dist/client/DeviceCodeClient.js +216 -0
  59. package/dist/client/DeviceCodeClient.js.map +1 -0
  60. package/dist/client/IConfidentialClientApplication.d.ts.map +1 -1
  61. package/dist/client/IPublicClientApplication.d.ts +1 -1
  62. package/dist/client/IPublicClientApplication.d.ts.map +1 -1
  63. package/dist/client/OnBehalfOfClient.d.ts +48 -0
  64. package/dist/client/OnBehalfOfClient.d.ts.map +1 -0
  65. package/dist/client/OnBehalfOfClient.esm.js +211 -0
  66. package/dist/client/OnBehalfOfClient.esm.js.map +1 -0
  67. package/dist/client/OnBehalfOfClient.js +213 -0
  68. package/dist/client/OnBehalfOfClient.js.map +1 -0
  69. package/dist/client/PublicClientApplication.d.ts +1 -1
  70. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  71. package/dist/client/PublicClientApplication.esm.js +187 -0
  72. package/dist/client/PublicClientApplication.esm.js.map +1 -0
  73. package/dist/client/PublicClientApplication.js +189 -0
  74. package/dist/client/PublicClientApplication.js.map +1 -0
  75. package/dist/client/UsernamePasswordClient.d.ts +26 -0
  76. package/dist/client/UsernamePasswordClient.d.ts.map +1 -0
  77. package/dist/client/UsernamePasswordClient.esm.js +109 -0
  78. package/dist/client/UsernamePasswordClient.esm.js.map +1 -0
  79. package/dist/client/UsernamePasswordClient.js +111 -0
  80. package/dist/client/UsernamePasswordClient.js.map +1 -0
  81. package/dist/config/Configuration.d.ts +9 -8
  82. package/dist/config/Configuration.d.ts.map +1 -1
  83. package/dist/config/Configuration.esm.js +78 -0
  84. package/dist/config/Configuration.esm.js.map +1 -0
  85. package/dist/config/Configuration.js +80 -0
  86. package/dist/config/Configuration.js.map +1 -0
  87. package/dist/crypto/CryptoProvider.d.ts.map +1 -1
  88. package/dist/crypto/CryptoProvider.esm.js +85 -0
  89. package/dist/crypto/CryptoProvider.esm.js.map +1 -0
  90. package/dist/crypto/CryptoProvider.js +87 -0
  91. package/dist/crypto/CryptoProvider.js.map +1 -0
  92. package/dist/crypto/GuidGenerator.d.ts.map +1 -1
  93. package/dist/crypto/GuidGenerator.esm.js +29 -0
  94. package/dist/crypto/GuidGenerator.esm.js.map +1 -0
  95. package/dist/crypto/GuidGenerator.js +31 -0
  96. package/dist/crypto/GuidGenerator.js.map +1 -0
  97. package/dist/crypto/HashUtils.d.ts.map +1 -1
  98. package/dist/crypto/HashUtils.esm.js +21 -0
  99. package/dist/crypto/HashUtils.esm.js.map +1 -0
  100. package/dist/crypto/HashUtils.js +23 -0
  101. package/dist/crypto/HashUtils.js.map +1 -0
  102. package/dist/crypto/PkceGenerator.d.ts.map +1 -1
  103. package/dist/crypto/PkceGenerator.esm.js +60 -0
  104. package/dist/crypto/PkceGenerator.esm.js.map +1 -0
  105. package/dist/crypto/PkceGenerator.js +62 -0
  106. package/dist/crypto/PkceGenerator.js.map +1 -0
  107. package/dist/error/NodeAuthError.d.ts.map +1 -1
  108. package/dist/error/NodeAuthError.esm.js +92 -0
  109. package/dist/error/NodeAuthError.esm.js.map +1 -0
  110. package/dist/error/NodeAuthError.js +95 -0
  111. package/dist/error/NodeAuthError.js.map +1 -0
  112. package/dist/index.d.ts +13 -3
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/index.esm.js +20 -0
  115. package/dist/index.esm.js.map +1 -0
  116. package/dist/index.js +101 -6
  117. package/dist/index.js.map +1 -0
  118. package/dist/internals.d.ts +7 -0
  119. package/dist/internals.d.ts.map +1 -0
  120. package/dist/internals.esm.js +10 -0
  121. package/dist/internals.esm.js.map +1 -0
  122. package/dist/internals.js +15 -0
  123. package/dist/internals.js.map +1 -0
  124. package/dist/network/HttpClient.d.ts +1 -0
  125. package/dist/network/HttpClient.d.ts.map +1 -1
  126. package/dist/network/HttpClient.esm.js +286 -0
  127. package/dist/network/HttpClient.esm.js.map +1 -0
  128. package/dist/network/HttpClient.js +288 -0
  129. package/dist/network/HttpClient.js.map +1 -0
  130. package/dist/network/ILoopbackClient.d.ts.map +1 -1
  131. package/dist/network/LoopbackClient.d.ts.map +1 -1
  132. package/dist/network/LoopbackClient.esm.js +94 -0
  133. package/dist/network/LoopbackClient.esm.js.map +1 -0
  134. package/dist/network/LoopbackClient.js +96 -0
  135. package/dist/network/LoopbackClient.js.map +1 -0
  136. package/dist/packageMetadata.d.ts +1 -1
  137. package/dist/packageMetadata.d.ts.map +1 -1
  138. package/dist/packageMetadata.esm.js +8 -0
  139. package/dist/packageMetadata.esm.js.map +1 -0
  140. package/dist/packageMetadata.js +11 -0
  141. package/dist/packageMetadata.js.map +1 -0
  142. package/dist/request/AuthorizationCodeRequest.d.ts +1 -1
  143. package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
  144. package/dist/request/AuthorizationUrlRequest.d.ts +1 -1
  145. package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
  146. package/dist/request/ClientCredentialRequest.d.ts +1 -1
  147. package/dist/request/ClientCredentialRequest.d.ts.map +1 -1
  148. package/dist/request/DeviceCodeRequest.d.ts +1 -1
  149. package/dist/request/DeviceCodeRequest.d.ts.map +1 -1
  150. package/dist/request/InteractiveRequest.d.ts +1 -1
  151. package/dist/request/InteractiveRequest.d.ts.map +1 -1
  152. package/dist/request/OnBehalfOfRequest.d.ts +1 -1
  153. package/dist/request/OnBehalfOfRequest.d.ts.map +1 -1
  154. package/dist/request/RefreshTokenRequest.d.ts +1 -1
  155. package/dist/request/RefreshTokenRequest.d.ts.map +1 -1
  156. package/dist/request/SignOutRequest.d.ts +1 -1
  157. package/dist/request/SignOutRequest.d.ts.map +1 -1
  158. package/dist/request/SilentFlowRequest.d.ts +1 -1
  159. package/dist/request/SilentFlowRequest.d.ts.map +1 -1
  160. package/dist/request/UsernamePasswordRequest.d.ts +1 -1
  161. package/dist/request/UsernamePasswordRequest.d.ts.map +1 -1
  162. package/dist/utils/Constants.d.ts.map +1 -1
  163. package/dist/utils/Constants.esm.js +98 -0
  164. package/dist/utils/Constants.esm.js.map +1 -0
  165. package/dist/utils/Constants.js +106 -0
  166. package/dist/utils/Constants.js.map +1 -0
  167. package/dist/utils/EncodingUtils.d.ts.map +1 -1
  168. package/dist/utils/EncodingUtils.esm.js +51 -0
  169. package/dist/utils/EncodingUtils.esm.js.map +1 -0
  170. package/dist/utils/EncodingUtils.js +53 -0
  171. package/dist/utils/EncodingUtils.js.map +1 -0
  172. package/dist/utils/NetworkUtils.d.ts.map +1 -1
  173. package/dist/utils/NetworkUtils.esm.js +43 -0
  174. package/dist/utils/NetworkUtils.esm.js.map +1 -0
  175. package/dist/utils/NetworkUtils.js +45 -0
  176. package/dist/utils/NetworkUtils.js.map +1 -0
  177. package/package.json +22 -16
@@ -0,0 +1,177 @@
1
+ /*! @azure/msal-node v2.0.0-alpha.1 2023-05-08 */
2
+ 'use strict';
3
+ 'use strict';
4
+
5
+ var ClientApplication = require('./ClientApplication.js');
6
+ var ClientAssertion = require('./ClientAssertion.js');
7
+ var Constants = require('../utils/Constants.js');
8
+ var msalCommon = require('@azure/msal-common');
9
+ var ClientCredentialClient = require('./ClientCredentialClient.js');
10
+ var OnBehalfOfClient = require('./OnBehalfOfClient.js');
11
+
12
+ /*
13
+ * Copyright (c) Microsoft Corporation. All rights reserved.
14
+ * Licensed under the MIT License.
15
+ */
16
+ /**
17
+ * This class is to be used to acquire tokens for confidential client applications (webApp, webAPI). Confidential client applications
18
+ * will configure application secrets, client certificates/assertions as applicable
19
+ * @public
20
+ */
21
+ class ConfidentialClientApplication extends ClientApplication.ClientApplication {
22
+ /**
23
+ * Constructor for the ConfidentialClientApplication
24
+ *
25
+ * Required attributes in the Configuration object are:
26
+ * - clientID: the application ID of your application. You can obtain one by registering your application with our application registration portal
27
+ * - authority: the authority URL for your application.
28
+ * - client credential: Must set either client secret, certificate, or assertion for confidential clients. You can obtain a client secret from the application registration portal.
29
+ *
30
+ * In Azure AD, authority is a URL indicating of the form https://login.microsoftonline.com/\{Enter_the_Tenant_Info_Here\}.
31
+ * If your application supports Accounts in one organizational directory, replace "Enter_the_Tenant_Info_Here" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).
32
+ * If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
33
+ * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
34
+ * To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
35
+ *
36
+ * In Azure B2C, authority is of the form https://\{instance\}/tfp/\{tenant\}/\{policyName\}/
37
+ * Full B2C functionality will be available in this library in future versions.
38
+ *
39
+ * @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
40
+ */
41
+ constructor(configuration) {
42
+ super(configuration);
43
+ this.setClientCredential(this.config);
44
+ this.appTokenProvider = undefined;
45
+ }
46
+ /**
47
+ * This extensibility point only works for the client_credential flow, i.e. acquireTokenByClientCredential and
48
+ * is meant for Azure SDK to enhance Managed Identity support.
49
+ *
50
+ * @param IAppTokenProvider - Extensibility interface, which allows the app developer to return a token from a custom source.
51
+ */
52
+ SetAppTokenProvider(provider) {
53
+ this.appTokenProvider = provider;
54
+ }
55
+ /**
56
+ * Acquires tokens from the authority for the application (not for an end user).
57
+ */
58
+ async acquireTokenByClientCredential(request) {
59
+ this.logger.info("acquireTokenByClientCredential called", request.correlationId);
60
+ // If there is a client assertion present in the request, it overrides the one present in the client configuration
61
+ let clientAssertion;
62
+ if (request.clientAssertion) {
63
+ clientAssertion = {
64
+ assertion: request.clientAssertion,
65
+ assertionType: Constants.Constants.JWT_BEARER_ASSERTION_TYPE,
66
+ };
67
+ }
68
+ const baseRequest = await this.initializeBaseRequest(request);
69
+ // valid base request should not contain oidc scopes in this grant type
70
+ const validBaseRequest = {
71
+ ...baseRequest,
72
+ scopes: baseRequest.scopes.filter((scope) => !msalCommon.OIDC_DEFAULT_SCOPES.includes(scope)),
73
+ };
74
+ const validRequest = {
75
+ ...request,
76
+ ...validBaseRequest,
77
+ clientAssertion,
78
+ };
79
+ /*
80
+ * valid request should not have "common" or "organizations" in lieu of the tenant_id in the authority in the auth configuration
81
+ * example authority: "https://login.microsoftonline.com/TenantId",
82
+ */
83
+ const authority = new msalCommon.UrlString(validRequest.authority);
84
+ const tenantId = authority.getUrlComponents().PathSegments[0];
85
+ if (Object.values(msalCommon.AADAuthorityConstants).includes(tenantId)) {
86
+ throw msalCommon.ClientAuthError.createMissingTenantIdError();
87
+ }
88
+ const azureRegionConfiguration = {
89
+ azureRegion: validRequest.azureRegion,
90
+ environmentRegion: process.env[Constants.REGION_ENVIRONMENT_VARIABLE],
91
+ };
92
+ const serverTelemetryManager = this.initializeServerTelemetryManager(Constants.ApiId.acquireTokenByClientCredential, validRequest.correlationId, validRequest.skipCache);
93
+ try {
94
+ const clientCredentialConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, azureRegionConfiguration, request.azureCloudOptions);
95
+ const clientCredentialClient = new ClientCredentialClient.ClientCredentialClient(clientCredentialConfig, this.appTokenProvider);
96
+ this.logger.verbose("Client credential client created", validRequest.correlationId);
97
+ return clientCredentialClient.acquireToken(validRequest);
98
+ }
99
+ catch (e) {
100
+ if (e instanceof msalCommon.AuthError) {
101
+ e.setCorrelationId(validRequest.correlationId);
102
+ }
103
+ serverTelemetryManager.cacheFailedRequest(e);
104
+ throw e;
105
+ }
106
+ }
107
+ /**
108
+ * Acquires tokens from the authority for the application.
109
+ *
110
+ * Used in scenarios where the current app is a middle-tier service which was called with a token
111
+ * representing an end user. The current app can use the token (oboAssertion) to request another
112
+ * token to access downstream web API, on behalf of that user.
113
+ *
114
+ * The current middle-tier app has no user interaction to obtain consent.
115
+ * See how to gain consent upfront for your middle-tier app from this article.
116
+ * https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow#gaining-consent-for-the-middle-tier-application
117
+ */
118
+ async acquireTokenOnBehalfOf(request) {
119
+ this.logger.info("acquireTokenOnBehalfOf called", request.correlationId);
120
+ const validRequest = {
121
+ ...request,
122
+ ...(await this.initializeBaseRequest(request)),
123
+ };
124
+ try {
125
+ const onBehalfOfConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, undefined, undefined, request.azureCloudOptions);
126
+ const oboClient = new OnBehalfOfClient.OnBehalfOfClient(onBehalfOfConfig);
127
+ this.logger.verbose("On behalf of client created", validRequest.correlationId);
128
+ return oboClient.acquireToken(validRequest);
129
+ }
130
+ catch (e) {
131
+ if (e instanceof msalCommon.AuthError) {
132
+ e.setCorrelationId(validRequest.correlationId);
133
+ }
134
+ throw e;
135
+ }
136
+ }
137
+ setClientCredential(configuration) {
138
+ const clientSecretNotEmpty = !msalCommon.StringUtils.isEmpty(configuration.auth.clientSecret);
139
+ const clientAssertionNotEmpty = !msalCommon.StringUtils.isEmpty(configuration.auth.clientAssertion);
140
+ const certificate = configuration.auth.clientCertificate || {
141
+ thumbprint: msalCommon.Constants.EMPTY_STRING,
142
+ privateKey: msalCommon.Constants.EMPTY_STRING,
143
+ };
144
+ const certificateNotEmpty = !msalCommon.StringUtils.isEmpty(certificate.thumbprint) ||
145
+ !msalCommon.StringUtils.isEmpty(certificate.privateKey);
146
+ /*
147
+ * If app developer configures this callback, they don't need a credential
148
+ * i.e. AzureSDK can get token from Managed Identity without a cert / secret
149
+ */
150
+ if (this.appTokenProvider) {
151
+ return;
152
+ }
153
+ // Check that at most one credential is set on the application
154
+ if ((clientSecretNotEmpty && clientAssertionNotEmpty) ||
155
+ (clientAssertionNotEmpty && certificateNotEmpty) ||
156
+ (clientSecretNotEmpty && certificateNotEmpty)) {
157
+ throw msalCommon.ClientAuthError.createInvalidCredentialError();
158
+ }
159
+ if (configuration.auth.clientSecret) {
160
+ this.clientSecret = configuration.auth.clientSecret;
161
+ return;
162
+ }
163
+ if (configuration.auth.clientAssertion) {
164
+ this.clientAssertion = ClientAssertion.ClientAssertion.fromAssertion(configuration.auth.clientAssertion);
165
+ return;
166
+ }
167
+ if (!certificateNotEmpty) {
168
+ throw msalCommon.ClientAuthError.createInvalidCredentialError();
169
+ }
170
+ else {
171
+ this.clientAssertion = ClientAssertion.ClientAssertion.fromCertificate(certificate.thumbprint, certificate.privateKey, configuration.auth.clientCertificate?.x5c);
172
+ }
173
+ }
174
+ }
175
+
176
+ exports.ConfidentialClientApplication = ConfidentialClientApplication;
177
+ //# sourceMappingURL=ConfidentialClientApplication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfidentialClientApplication.js","sources":["../../src/client/ConfidentialClientApplication.ts"],"sourcesContent":[null],"names":["ClientApplication","NodeConstants","OIDC_DEFAULT_SCOPES","UrlString","AADAuthorityConstants","ClientAuthError","REGION_ENVIRONMENT_VARIABLE","ApiId","ClientCredentialClient","AuthError","OnBehalfOfClient","StringUtils","Constants","ClientAssertion"],"mappings":";;;;;;;;;;;AAAA;;;AAGG;AAgCH;;;;AAIG;AACG,MAAO,6BACT,SAAQA,mCAAiB,CAAA;AAKzB;;;;;;;;;;;;;;;;;;AAkBG;AACH,IAAA,WAAA,CAAY,aAA4B,EAAA;QACpC,KAAK,CAAC,aAAa,CAAC,CAAC;AACrB,QAAA,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACtC,QAAA,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;KACrC;AAED;;;;;AAKG;AACH,IAAA,mBAAmB,CAAC,QAA2B,EAAA;AAC3C,QAAA,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;KACpC;AAED;;AAEG;IACI,MAAM,8BAA8B,CACvC,OAAgC,EAAA;QAEhC,IAAI,CAAC,MAAM,CAAC,IAAI,CACZ,uCAAuC,EACvC,OAAO,CAAC,aAAa,CACxB,CAAC;;AAGF,QAAA,IAAI,eAAe,CAAC;QACpB,IAAI,OAAO,CAAC,eAAe,EAAE;AACzB,YAAA,eAAe,GAAG;gBACd,SAAS,EAAE,OAAO,CAAC,eAAe;gBAClC,aAAa,EAAEC,mBAAa,CAAC,yBAAyB;aACzD,CAAC;AACL,SAAA;QAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;;AAG9D,QAAA,MAAM,gBAAgB,GAAG;AACrB,YAAA,GAAG,WAAW;AACd,YAAA,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,CAC7B,CAAC,KAAa,KAAK,CAACC,8BAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAC1D;SACJ,CAAC;AAEF,QAAA,MAAM,YAAY,GAAkC;AAChD,YAAA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}
@@ -0,0 +1,54 @@
1
+ import { AuthenticationResult, BaseClient, ClientConfiguration, CommonDeviceCodeRequest } from "@azure/msal-common";
2
+ /**
3
+ * OAuth2.0 Device code client
4
+ */
5
+ export declare class DeviceCodeClient extends BaseClient {
6
+ constructor(configuration: ClientConfiguration);
7
+ /**
8
+ * Gets device code from device code endpoint, calls back to with device code response, and
9
+ * polls token endpoint to exchange device code for tokens
10
+ * @param request
11
+ */
12
+ acquireToken(request: CommonDeviceCodeRequest): Promise<AuthenticationResult | null>;
13
+ /**
14
+ * Creates device code request and executes http GET
15
+ * @param request
16
+ */
17
+ private getDeviceCode;
18
+ /**
19
+ * Creates query string for the device code request
20
+ * @param request
21
+ */
22
+ createExtraQueryParameters(request: CommonDeviceCodeRequest): string;
23
+ /**
24
+ * Executes POST request to device code endpoint
25
+ * @param deviceCodeEndpoint
26
+ * @param queryString
27
+ * @param headers
28
+ */
29
+ private executePostRequestToDeviceCodeEndpoint;
30
+ /**
31
+ * Create device code endpoint query parameters and returns string
32
+ */
33
+ private createQueryString;
34
+ /**
35
+ * Breaks the polling with specific conditions.
36
+ * @param request CommonDeviceCodeRequest
37
+ * @param deviceCodeResponse DeviceCodeResponse
38
+ */
39
+ private continuePolling;
40
+ /**
41
+ * Creates token request with device code response and polls token endpoint at interval set by the device code
42
+ * response
43
+ * @param request
44
+ * @param deviceCodeResponse
45
+ */
46
+ private acquireTokenWithDeviceCode;
47
+ /**
48
+ * Creates query parameters and converts to string.
49
+ * @param request
50
+ * @param deviceCodeResponse
51
+ */
52
+ private createTokenRequestBody;
53
+ }
54
+ //# sourceMappingURL=DeviceCodeClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceCodeClient.d.ts","sourceRoot":"","sources":["../../src/client/DeviceCodeClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,oBAAoB,EACpB,UAAU,EAEV,mBAAmB,EACnB,uBAAuB,EAa1B,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;gBAChC,aAAa,EAAE,mBAAmB;IAI9C;;;;OAIG;IACU,YAAY,CACrB,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA4BvC;;;OAGG;YACW,aAAa;IA8B3B;;;OAGG;IACH,0BAA0B,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM;IAYpE;;;;;OAKG;YACW,sCAAsC;IAkCpD;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAiCvB;;;;;OAKG;YACW,0BAA0B;IAoFxC;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;CAqCjC"}
@@ -0,0 +1,214 @@
1
+ /*! @azure/msal-node v2.0.0-alpha.1 2023-05-08 */
2
+ 'use strict';
3
+ import { BaseClient, TimeUtils, ResponseHandler, UrlString, RequestParameterBuilder, StringUtils, ClientAuthError, Constants, ServerError, GrantType } from '@azure/msal-common';
4
+
5
+ /*
6
+ * Copyright (c) Microsoft Corporation. All rights reserved.
7
+ * Licensed under the MIT License.
8
+ */
9
+ /**
10
+ * OAuth2.0 Device code client
11
+ */
12
+ class DeviceCodeClient extends BaseClient {
13
+ constructor(configuration) {
14
+ super(configuration);
15
+ }
16
+ /**
17
+ * Gets device code from device code endpoint, calls back to with device code response, and
18
+ * polls token endpoint to exchange device code for tokens
19
+ * @param request
20
+ */
21
+ async acquireToken(request) {
22
+ const deviceCodeResponse = await this.getDeviceCode(request);
23
+ request.deviceCodeCallback(deviceCodeResponse);
24
+ const reqTimestamp = TimeUtils.nowSeconds();
25
+ const response = await this.acquireTokenWithDeviceCode(request, deviceCodeResponse);
26
+ const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
27
+ // Validate response. This function throws a server error if an error is returned by the server.
28
+ responseHandler.validateTokenResponse(response);
29
+ return await responseHandler.handleServerTokenResponse(response, this.authority, reqTimestamp, request);
30
+ }
31
+ /**
32
+ * Creates device code request and executes http GET
33
+ * @param request
34
+ */
35
+ async getDeviceCode(request) {
36
+ const queryParametersString = this.createExtraQueryParameters(request);
37
+ const endpoint = UrlString.appendQueryString(this.authority.deviceCodeEndpoint, queryParametersString);
38
+ const queryString = this.createQueryString(request);
39
+ const headers = this.createTokenRequestHeaders();
40
+ const thumbprint = {
41
+ clientId: this.config.authOptions.clientId,
42
+ authority: request.authority,
43
+ scopes: request.scopes,
44
+ claims: request.claims,
45
+ authenticationScheme: request.authenticationScheme,
46
+ resourceRequestMethod: request.resourceRequestMethod,
47
+ resourceRequestUri: request.resourceRequestUri,
48
+ shrClaims: request.shrClaims,
49
+ sshKid: request.sshKid,
50
+ };
51
+ return this.executePostRequestToDeviceCodeEndpoint(endpoint, queryString, headers, thumbprint);
52
+ }
53
+ /**
54
+ * Creates query string for the device code request
55
+ * @param request
56
+ */
57
+ createExtraQueryParameters(request) {
58
+ const parameterBuilder = new RequestParameterBuilder();
59
+ if (request.extraQueryParameters) {
60
+ parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
61
+ }
62
+ return parameterBuilder.createQueryString();
63
+ }
64
+ /**
65
+ * Executes POST request to device code endpoint
66
+ * @param deviceCodeEndpoint
67
+ * @param queryString
68
+ * @param headers
69
+ */
70
+ async executePostRequestToDeviceCodeEndpoint(deviceCodeEndpoint, queryString, headers, thumbprint) {
71
+ const { body: { user_code: userCode, device_code: deviceCode, verification_uri: verificationUri, expires_in: expiresIn, interval, message, }, } = await this.networkManager.sendPostRequest(thumbprint, deviceCodeEndpoint, {
72
+ body: queryString,
73
+ headers: headers,
74
+ });
75
+ return {
76
+ userCode,
77
+ deviceCode,
78
+ verificationUri,
79
+ expiresIn,
80
+ interval,
81
+ message,
82
+ };
83
+ }
84
+ /**
85
+ * Create device code endpoint query parameters and returns string
86
+ */
87
+ createQueryString(request) {
88
+ const parameterBuilder = new RequestParameterBuilder();
89
+ parameterBuilder.addScopes(request.scopes);
90
+ parameterBuilder.addClientId(this.config.authOptions.clientId);
91
+ if (request.extraQueryParameters) {
92
+ parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
93
+ }
94
+ if (!StringUtils.isEmpty(request.claims) ||
95
+ (this.config.authOptions.clientCapabilities &&
96
+ this.config.authOptions.clientCapabilities.length > 0)) {
97
+ parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
98
+ }
99
+ return parameterBuilder.createQueryString();
100
+ }
101
+ /**
102
+ * Breaks the polling with specific conditions.
103
+ * @param request CommonDeviceCodeRequest
104
+ * @param deviceCodeResponse DeviceCodeResponse
105
+ */
106
+ continuePolling(deviceCodeExpirationTime, userSpecifiedTimeout, userSpecifiedCancelFlag) {
107
+ if (userSpecifiedCancelFlag) {
108
+ this.logger.error("Token request cancelled by setting DeviceCodeRequest.cancel = true");
109
+ throw ClientAuthError.createDeviceCodeCancelledError();
110
+ }
111
+ else if (userSpecifiedTimeout &&
112
+ userSpecifiedTimeout < deviceCodeExpirationTime &&
113
+ TimeUtils.nowSeconds() > userSpecifiedTimeout) {
114
+ this.logger.error(`User defined timeout for device code polling reached. The timeout was set for ${userSpecifiedTimeout}`);
115
+ throw ClientAuthError.createUserTimeoutReachedError();
116
+ }
117
+ else if (TimeUtils.nowSeconds() > deviceCodeExpirationTime) {
118
+ if (userSpecifiedTimeout) {
119
+ this.logger.verbose(`User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for ${userSpecifiedTimeout}`);
120
+ }
121
+ this.logger.error(`Device code expired. Expiration time of device code was ${deviceCodeExpirationTime}`);
122
+ throw ClientAuthError.createDeviceCodeExpiredError();
123
+ }
124
+ return true;
125
+ }
126
+ /**
127
+ * Creates token request with device code response and polls token endpoint at interval set by the device code
128
+ * response
129
+ * @param request
130
+ * @param deviceCodeResponse
131
+ */
132
+ async acquireTokenWithDeviceCode(request, deviceCodeResponse) {
133
+ const queryParametersString = this.createTokenQueryParameters(request);
134
+ const endpoint = UrlString.appendQueryString(this.authority.tokenEndpoint, queryParametersString);
135
+ const requestBody = this.createTokenRequestBody(request, deviceCodeResponse);
136
+ const headers = this.createTokenRequestHeaders();
137
+ const userSpecifiedTimeout = request.timeout
138
+ ? TimeUtils.nowSeconds() + request.timeout
139
+ : undefined;
140
+ const deviceCodeExpirationTime = TimeUtils.nowSeconds() + deviceCodeResponse.expiresIn;
141
+ const pollingIntervalMilli = deviceCodeResponse.interval * 1000;
142
+ /*
143
+ * Poll token endpoint while (device code is not expired AND operation has not been cancelled by
144
+ * setting CancellationToken.cancel = true). POST request is sent at interval set by pollingIntervalMilli
145
+ */
146
+ while (this.continuePolling(deviceCodeExpirationTime, userSpecifiedTimeout, request.cancel)) {
147
+ const thumbprint = {
148
+ clientId: this.config.authOptions.clientId,
149
+ authority: request.authority,
150
+ scopes: request.scopes,
151
+ claims: request.claims,
152
+ authenticationScheme: request.authenticationScheme,
153
+ resourceRequestMethod: request.resourceRequestMethod,
154
+ resourceRequestUri: request.resourceRequestUri,
155
+ shrClaims: request.shrClaims,
156
+ sshKid: request.sshKid,
157
+ };
158
+ const response = await this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint);
159
+ if (response.body && response.body.error) {
160
+ // user authorization is pending. Sleep for polling interval and try again
161
+ if (response.body.error === Constants.AUTHORIZATION_PENDING) {
162
+ this.logger.info("Authorization pending. Continue polling.");
163
+ await TimeUtils.delay(pollingIntervalMilli);
164
+ }
165
+ else {
166
+ // for any other error, throw
167
+ this.logger.info("Unexpected error in polling from the server");
168
+ throw ServerError.createPostRequestFailed(response.body.error);
169
+ }
170
+ }
171
+ else {
172
+ this.logger.verbose("Authorization completed successfully. Polling stopped.");
173
+ return response.body;
174
+ }
175
+ }
176
+ /*
177
+ * The above code should've thrown by this point, but to satisfy TypeScript,
178
+ * and in the rare case the conditionals in continuePolling() may not catch everything...
179
+ */
180
+ this.logger.error("Polling stopped for unknown reasons.");
181
+ throw ClientAuthError.createDeviceCodeUnknownError();
182
+ }
183
+ /**
184
+ * Creates query parameters and converts to string.
185
+ * @param request
186
+ * @param deviceCodeResponse
187
+ */
188
+ createTokenRequestBody(request, deviceCodeResponse) {
189
+ const requestParameters = new RequestParameterBuilder();
190
+ requestParameters.addScopes(request.scopes);
191
+ requestParameters.addClientId(this.config.authOptions.clientId);
192
+ requestParameters.addGrantType(GrantType.DEVICE_CODE_GRANT);
193
+ requestParameters.addDeviceCode(deviceCodeResponse.deviceCode);
194
+ const correlationId = request.correlationId ||
195
+ this.config.cryptoInterface.createNewGuid();
196
+ requestParameters.addCorrelationId(correlationId);
197
+ requestParameters.addClientInfo();
198
+ requestParameters.addLibraryInfo(this.config.libraryInfo);
199
+ requestParameters.addApplicationTelemetry(this.config.telemetry.application);
200
+ requestParameters.addThrottling();
201
+ if (this.serverTelemetryManager) {
202
+ requestParameters.addServerTelemetry(this.serverTelemetryManager);
203
+ }
204
+ if (!StringUtils.isEmptyObj(request.claims) ||
205
+ (this.config.authOptions.clientCapabilities &&
206
+ this.config.authOptions.clientCapabilities.length > 0)) {
207
+ requestParameters.addClaims(request.claims, this.config.authOptions.clientCapabilities);
208
+ }
209
+ return requestParameters.createQueryString();
210
+ }
211
+ }
212
+
213
+ export { DeviceCodeClient };
214
+ //# sourceMappingURL=DeviceCodeClient.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceCodeClient.esm.js","sources":["../../src/client/DeviceCodeClient.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;;;AAGG;AAsBH;;AAEG;AACG,MAAO,gBAAiB,SAAQ,UAAU,CAAA;AAC5C,IAAA,WAAA,CAAY,aAAkC,EAAA;QAC1C,KAAK,CAAC,aAAa,CAAC,CAAC;KACxB;AAED;;;;AAIG;IACI,MAAM,YAAY,CACrB,OAAgC,EAAA;QAEhC,MAAM,kBAAkB,GAAuB,MAAM,IAAI,CAAC,aAAa,CACnE,OAAO,CACV,CAAC;AACF,QAAA,OAAO,CAAC,kB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