@azure/msal-node 2.0.0-alpha.1 → 2.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.
Files changed (107) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +182 -182
  3. package/dist/cache/ITokenCache.d.ts +15 -15
  4. package/dist/cache/NodeStorage.d.ts +182 -182
  5. package/dist/cache/NodeStorage.esm.js +401 -401
  6. package/dist/cache/NodeStorage.js +401 -401
  7. package/dist/cache/TokenCache.d.ts +90 -90
  8. package/dist/cache/TokenCache.esm.js +269 -269
  9. package/dist/cache/TokenCache.js +269 -269
  10. package/dist/cache/distributed/DistributedCachePlugin.d.ts +10 -10
  11. package/dist/cache/distributed/DistributedCachePlugin.esm.js +26 -26
  12. package/dist/cache/distributed/DistributedCachePlugin.js +26 -26
  13. package/dist/cache/distributed/ICacheClient.d.ts +17 -17
  14. package/dist/cache/distributed/IPartitionManager.d.ts +28 -28
  15. package/dist/cache/serializer/Deserializer.d.ts +42 -42
  16. package/dist/cache/serializer/Deserializer.esm.js +175 -175
  17. package/dist/cache/serializer/Deserializer.js +175 -175
  18. package/dist/cache/serializer/Serializer.d.ts +39 -39
  19. package/dist/cache/serializer/Serializer.esm.js +134 -134
  20. package/dist/cache/serializer/Serializer.js +134 -134
  21. package/dist/cache/serializer/SerializerTypes.d.ts +101 -101
  22. package/dist/client/ClientApplication.d.ts +142 -142
  23. package/dist/client/ClientApplication.esm.js +327 -327
  24. package/dist/client/ClientApplication.js +327 -327
  25. package/dist/client/ClientAssertion.d.ts +46 -46
  26. package/dist/client/ClientAssertion.esm.js +116 -116
  27. package/dist/client/ClientAssertion.js +116 -116
  28. package/dist/client/ClientCredentialClient.d.ts +33 -33
  29. package/dist/client/ClientCredentialClient.esm.js +157 -157
  30. package/dist/client/ClientCredentialClient.js +157 -157
  31. package/dist/client/ConfidentialClientApplication.d.ts +58 -58
  32. package/dist/client/ConfidentialClientApplication.esm.js +163 -163
  33. package/dist/client/ConfidentialClientApplication.js +163 -163
  34. package/dist/client/DeviceCodeClient.d.ts +53 -53
  35. package/dist/client/DeviceCodeClient.esm.js +207 -207
  36. package/dist/client/DeviceCodeClient.js +207 -207
  37. package/dist/client/IConfidentialClientApplication.d.ts +39 -39
  38. package/dist/client/IPublicClientApplication.d.ts +42 -42
  39. package/dist/client/OnBehalfOfClient.d.ts +47 -47
  40. package/dist/client/OnBehalfOfClient.esm.js +204 -204
  41. package/dist/client/OnBehalfOfClient.js +204 -204
  42. package/dist/client/PublicClientApplication.d.ts +65 -65
  43. package/dist/client/PublicClientApplication.esm.js +175 -175
  44. package/dist/client/PublicClientApplication.js +175 -175
  45. package/dist/client/UsernamePasswordClient.d.ts +25 -25
  46. package/dist/client/UsernamePasswordClient.esm.js +102 -102
  47. package/dist/client/UsernamePasswordClient.js +102 -102
  48. package/dist/config/Configuration.d.ts +105 -105
  49. package/dist/config/Configuration.esm.js +70 -70
  50. package/dist/config/Configuration.js +70 -70
  51. package/dist/crypto/CryptoProvider.d.ts +52 -52
  52. package/dist/crypto/CryptoProvider.esm.js +75 -75
  53. package/dist/crypto/CryptoProvider.js +75 -75
  54. package/dist/crypto/GuidGenerator.d.ts +14 -14
  55. package/dist/crypto/GuidGenerator.esm.js +22 -22
  56. package/dist/crypto/GuidGenerator.js +22 -22
  57. package/dist/crypto/HashUtils.d.ts +8 -8
  58. package/dist/crypto/HashUtils.esm.js +13 -13
  59. package/dist/crypto/HashUtils.js +13 -13
  60. package/dist/crypto/PkceGenerator.d.ts +22 -22
  61. package/dist/crypto/PkceGenerator.esm.js +49 -49
  62. package/dist/crypto/PkceGenerator.js +49 -49
  63. package/dist/error/NodeAuthError.d.ts +65 -65
  64. package/dist/error/NodeAuthError.esm.js +85 -85
  65. package/dist/error/NodeAuthError.js +85 -85
  66. package/dist/index.d.ts +41 -41
  67. package/dist/index.esm.js +1 -1
  68. package/dist/index.js +1 -1
  69. package/dist/internals.d.ts +6 -6
  70. package/dist/internals.esm.js +4 -4
  71. package/dist/internals.js +4 -4
  72. package/dist/network/HttpClient.d.ts +25 -25
  73. package/dist/network/HttpClient.esm.js +276 -276
  74. package/dist/network/HttpClient.js +276 -276
  75. package/dist/network/ILoopbackClient.d.ts +10 -10
  76. package/dist/network/LoopbackClient.d.ts +21 -21
  77. package/dist/network/LoopbackClient.esm.js +84 -84
  78. package/dist/network/LoopbackClient.js +84 -84
  79. package/dist/packageMetadata.d.ts +2 -2
  80. package/dist/packageMetadata.esm.js +4 -4
  81. package/dist/packageMetadata.js +4 -4
  82. package/dist/request/AuthorizationCodeRequest.d.ts +21 -21
  83. package/dist/request/AuthorizationUrlRequest.d.ts +33 -33
  84. package/dist/request/ClientCredentialRequest.d.ts +15 -15
  85. package/dist/request/DeviceCodeRequest.d.ts +15 -15
  86. package/dist/request/InteractiveRequest.d.ts +22 -22
  87. package/dist/request/OnBehalfOfRequest.d.ts +14 -14
  88. package/dist/request/RefreshTokenRequest.d.ts +17 -17
  89. package/dist/request/SignOutRequest.d.ts +5 -5
  90. package/dist/request/SilentFlowRequest.d.ts +16 -16
  91. package/dist/request/UsernamePasswordRequest.d.ts +19 -19
  92. package/dist/utils/Constants.d.ts +92 -92
  93. package/dist/utils/Constants.esm.js +93 -93
  94. package/dist/utils/Constants.js +93 -93
  95. package/dist/utils/EncodingUtils.d.ts +26 -26
  96. package/dist/utils/EncodingUtils.esm.js +44 -44
  97. package/dist/utils/EncodingUtils.js +44 -44
  98. package/dist/utils/NetworkUtils.d.ts +5 -5
  99. package/dist/utils/NetworkUtils.esm.js +38 -38
  100. package/dist/utils/NetworkUtils.js +38 -38
  101. package/package.json +73 -73
  102. package/dist/msal-node.cjs.development.js +0 -2705
  103. package/dist/msal-node.cjs.development.js.map +0 -1
  104. package/dist/msal-node.cjs.production.min.js +0 -2
  105. package/dist/msal-node.cjs.production.min.js.map +0 -1
  106. package/dist/msal-node.esm.js +0 -2594
  107. package/dist/msal-node.esm.js.map +0 -1
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v2.0.0-alpha.1 2023-05-08 */
1
+ /*! @azure/msal-node v2.0.0-alpha.2 2023-05-17 */
2
2
  'use strict';
3
3
  import { ApiId, Constants } from '../utils/Constants.esm.js';
4
4
  import { AuthError, ServerError, OIDC_DEFAULT_SCOPES, ResponseMode, CodeChallengeMethodValues, Constants as Constants$1 } from '@azure/msal-common';
@@ -7,180 +7,180 @@ import { NodeAuthError } from '../error/NodeAuthError.esm.js';
7
7
  import { LoopbackClient } from '../network/LoopbackClient.esm.js';
8
8
  import { DeviceCodeClient } from './DeviceCodeClient.esm.js';
9
9
 
10
- /*
11
- * Copyright (c) Microsoft Corporation. All rights reserved.
12
- * Licensed under the MIT License.
13
- */
14
- /**
15
- * This class is to be used to acquire tokens for public client applications (desktop, mobile). Public client applications
16
- * are not trusted to safely store application secrets, and therefore can only request tokens in the name of an user.
17
- * @public
18
- */
19
- class PublicClientApplication extends ClientApplication {
20
- /**
21
- * Important attributes in the Configuration object for auth are:
22
- * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal.
23
- * - authority: the authority URL for your application.
24
- *
25
- * AAD authorities are of the form https://login.microsoftonline.com/\{Enter_the_Tenant_Info_Here\}.
26
- * - 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).
27
- * - If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
28
- * - If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
29
- * - To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
30
- *
31
- * Azure B2C authorities are of the form https://\{instance\}/\{tenant\}/\{policy\}. Each policy is considered
32
- * its own authority. You will have to set the all of the knownAuthorities at the time of the client application
33
- * construction.
34
- *
35
- * ADFS authorities are of the form https://\{instance\}/adfs.
36
- */
37
- constructor(configuration) {
38
- super(configuration);
39
- if (this.config.broker.nativeBrokerPlugin) {
40
- if (this.config.broker.nativeBrokerPlugin.isBrokerAvailable) {
41
- this.nativeBrokerPlugin = this.config.broker.nativeBrokerPlugin;
42
- this.nativeBrokerPlugin.setLogger(this.config.system.loggerOptions);
43
- }
44
- else {
45
- this.logger.warning("NativeBroker implementation was provided but the broker is unavailable.");
46
- }
47
- }
48
- }
49
- /**
50
- * Acquires a token from the authority using OAuth2.0 device code flow.
51
- * This flow is designed for devices that do not have access to a browser or have input constraints.
52
- * The authorization server issues a DeviceCode object with a verification code, an end-user code,
53
- * and the end-user verification URI. The DeviceCode object is provided through a callback, and the end-user should be
54
- * instructed to use another device to navigate to the verification URI to input credentials.
55
- * Since the client cannot receive incoming requests, it polls the authorization server repeatedly
56
- * until the end-user completes input of credentials.
57
- */
58
- async acquireTokenByDeviceCode(request) {
59
- this.logger.info("acquireTokenByDeviceCode called", request.correlationId);
60
- const validRequest = Object.assign(request, await this.initializeBaseRequest(request));
61
- const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByDeviceCode, validRequest.correlationId);
62
- try {
63
- const deviceCodeConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, undefined, request.azureCloudOptions);
64
- const deviceCodeClient = new DeviceCodeClient(deviceCodeConfig);
65
- this.logger.verbose("Device code client created", validRequest.correlationId);
66
- return deviceCodeClient.acquireToken(validRequest);
67
- }
68
- catch (e) {
69
- if (e instanceof AuthError) {
70
- e.setCorrelationId(validRequest.correlationId);
71
- }
72
- serverTelemetryManager.cacheFailedRequest(e);
73
- throw e;
74
- }
75
- }
76
- /**
77
- * Acquires a token interactively via the browser by requesting an authorization code then exchanging it for a token.
78
- */
79
- async acquireTokenInteractive(request) {
80
- const correlationId = request.correlationId || this.cryptoProvider.createNewGuid();
81
- this.logger.trace("acquireTokenInteractive called", correlationId);
82
- const { openBrowser, successTemplate, errorTemplate, windowHandle, loopbackClient: customLoopbackClient, ...remainingProperties } = request;
83
- if (this.nativeBrokerPlugin) {
84
- const brokerRequest = {
85
- ...remainingProperties,
86
- clientId: this.config.auth.clientId,
87
- scopes: request.scopes || OIDC_DEFAULT_SCOPES,
88
- redirectUri: `${Constants.HTTP_PROTOCOL}${Constants.LOCALHOST}`,
89
- authority: request.authority || this.config.auth.authority,
90
- correlationId: correlationId,
91
- extraParameters: {
92
- ...remainingProperties.extraQueryParameters,
93
- ...remainingProperties.tokenQueryParameters,
94
- },
95
- accountId: remainingProperties.account?.nativeAccountId,
96
- };
97
- return this.nativeBrokerPlugin.acquireTokenInteractive(brokerRequest, windowHandle);
98
- }
99
- const { verifier, challenge } = await this.cryptoProvider.generatePkceCodes();
100
- const loopbackClient = customLoopbackClient || new LoopbackClient();
101
- const authCodeListener = loopbackClient.listenForAuthCode(successTemplate, errorTemplate);
102
- const redirectUri = loopbackClient.getRedirectUri();
103
- const validRequest = {
104
- ...remainingProperties,
105
- correlationId: correlationId,
106
- scopes: request.scopes || OIDC_DEFAULT_SCOPES,
107
- redirectUri: redirectUri,
108
- responseMode: ResponseMode.QUERY,
109
- codeChallenge: challenge,
110
- codeChallengeMethod: CodeChallengeMethodValues.S256,
111
- };
112
- const authCodeUrl = await this.getAuthCodeUrl(validRequest);
113
- await openBrowser(authCodeUrl);
114
- const authCodeResponse = await authCodeListener.finally(() => {
115
- loopbackClient.closeServer();
116
- });
117
- if (authCodeResponse.error) {
118
- throw new ServerError(authCodeResponse.error, authCodeResponse.error_description, authCodeResponse.suberror);
119
- }
120
- else if (!authCodeResponse.code) {
121
- throw NodeAuthError.createNoAuthCodeInResponseError();
122
- }
123
- const clientInfo = authCodeResponse.client_info;
124
- const tokenRequest = {
125
- code: authCodeResponse.code,
126
- codeVerifier: verifier,
127
- clientInfo: clientInfo || Constants$1.EMPTY_STRING,
128
- ...validRequest,
129
- };
130
- return this.acquireTokenByCode(tokenRequest);
131
- }
132
- /**
133
- * Returns a token retrieved either from the cache or by exchanging the refresh token for a fresh access token. If brokering is enabled the token request will be serviced by the broker.
134
- * @param request
135
- * @returns
136
- */
137
- async acquireTokenSilent(request) {
138
- const correlationId = request.correlationId || this.cryptoProvider.createNewGuid();
139
- this.logger.trace("acquireTokenSilent called", correlationId);
140
- if (this.nativeBrokerPlugin) {
141
- const brokerRequest = {
142
- ...request,
143
- clientId: this.config.auth.clientId,
144
- scopes: request.scopes || OIDC_DEFAULT_SCOPES,
145
- redirectUri: `${Constants.HTTP_PROTOCOL}${Constants.LOCALHOST}`,
146
- authority: request.authority || this.config.auth.authority,
147
- correlationId: correlationId,
148
- extraParameters: request.tokenQueryParameters,
149
- accountId: request.account.nativeAccountId,
150
- forceRefresh: request.forceRefresh || false,
151
- };
152
- return this.nativeBrokerPlugin.acquireTokenSilent(brokerRequest);
153
- }
154
- return super.acquireTokenSilent(request);
155
- }
156
- /**
157
- * Removes cache artifacts associated with the given account
158
- * @param request
159
- * @returns
160
- */
161
- async signOut(request) {
162
- if (this.nativeBrokerPlugin && request.account.nativeAccountId) {
163
- const signoutRequest = {
164
- clientId: this.config.auth.clientId,
165
- accountId: request.account.nativeAccountId,
166
- correlationId: request.correlationId ||
167
- this.cryptoProvider.createNewGuid(),
168
- };
169
- await this.nativeBrokerPlugin.signOut(signoutRequest);
170
- }
171
- await this.getTokenCache().removeAccount(request.account);
172
- }
173
- /**
174
- * Returns all cached accounts for this application. If brokering is enabled this request will be serviced by the broker.
175
- * @returns
176
- */
177
- async getAllAccounts() {
178
- if (this.nativeBrokerPlugin) {
179
- const correlationId = this.cryptoProvider.createNewGuid();
180
- return this.nativeBrokerPlugin.getAllAccounts(this.config.auth.clientId, correlationId);
181
- }
182
- return this.getTokenCache().getAllAccounts();
183
- }
10
+ /*
11
+ * Copyright (c) Microsoft Corporation. All rights reserved.
12
+ * Licensed under the MIT License.
13
+ */
14
+ /**
15
+ * This class is to be used to acquire tokens for public client applications (desktop, mobile). Public client applications
16
+ * are not trusted to safely store application secrets, and therefore can only request tokens in the name of an user.
17
+ * @public
18
+ */
19
+ class PublicClientApplication extends ClientApplication {
20
+ /**
21
+ * Important attributes in the Configuration object for auth are:
22
+ * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal.
23
+ * - authority: the authority URL for your application.
24
+ *
25
+ * AAD authorities are of the form https://login.microsoftonline.com/\{Enter_the_Tenant_Info_Here\}.
26
+ * - 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).
27
+ * - If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
28
+ * - If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
29
+ * - To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
30
+ *
31
+ * Azure B2C authorities are of the form https://\{instance\}/\{tenant\}/\{policy\}. Each policy is considered
32
+ * its own authority. You will have to set the all of the knownAuthorities at the time of the client application
33
+ * construction.
34
+ *
35
+ * ADFS authorities are of the form https://\{instance\}/adfs.
36
+ */
37
+ constructor(configuration) {
38
+ super(configuration);
39
+ if (this.config.broker.nativeBrokerPlugin) {
40
+ if (this.config.broker.nativeBrokerPlugin.isBrokerAvailable) {
41
+ this.nativeBrokerPlugin = this.config.broker.nativeBrokerPlugin;
42
+ this.nativeBrokerPlugin.setLogger(this.config.system.loggerOptions);
43
+ }
44
+ else {
45
+ this.logger.warning("NativeBroker implementation was provided but the broker is unavailable.");
46
+ }
47
+ }
48
+ }
49
+ /**
50
+ * Acquires a token from the authority using OAuth2.0 device code flow.
51
+ * This flow is designed for devices that do not have access to a browser or have input constraints.
52
+ * The authorization server issues a DeviceCode object with a verification code, an end-user code,
53
+ * and the end-user verification URI. The DeviceCode object is provided through a callback, and the end-user should be
54
+ * instructed to use another device to navigate to the verification URI to input credentials.
55
+ * Since the client cannot receive incoming requests, it polls the authorization server repeatedly
56
+ * until the end-user completes input of credentials.
57
+ */
58
+ async acquireTokenByDeviceCode(request) {
59
+ this.logger.info("acquireTokenByDeviceCode called", request.correlationId);
60
+ const validRequest = Object.assign(request, await this.initializeBaseRequest(request));
61
+ const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByDeviceCode, validRequest.correlationId);
62
+ try {
63
+ const deviceCodeConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, undefined, request.azureCloudOptions);
64
+ const deviceCodeClient = new DeviceCodeClient(deviceCodeConfig);
65
+ this.logger.verbose("Device code client created", validRequest.correlationId);
66
+ return deviceCodeClient.acquireToken(validRequest);
67
+ }
68
+ catch (e) {
69
+ if (e instanceof AuthError) {
70
+ e.setCorrelationId(validRequest.correlationId);
71
+ }
72
+ serverTelemetryManager.cacheFailedRequest(e);
73
+ throw e;
74
+ }
75
+ }
76
+ /**
77
+ * Acquires a token interactively via the browser by requesting an authorization code then exchanging it for a token.
78
+ */
79
+ async acquireTokenInteractive(request) {
80
+ const correlationId = request.correlationId || this.cryptoProvider.createNewGuid();
81
+ this.logger.trace("acquireTokenInteractive called", correlationId);
82
+ const { openBrowser, successTemplate, errorTemplate, windowHandle, loopbackClient: customLoopbackClient, ...remainingProperties } = request;
83
+ if (this.nativeBrokerPlugin) {
84
+ const brokerRequest = {
85
+ ...remainingProperties,
86
+ clientId: this.config.auth.clientId,
87
+ scopes: request.scopes || OIDC_DEFAULT_SCOPES,
88
+ redirectUri: `${Constants.HTTP_PROTOCOL}${Constants.LOCALHOST}`,
89
+ authority: request.authority || this.config.auth.authority,
90
+ correlationId: correlationId,
91
+ extraParameters: {
92
+ ...remainingProperties.extraQueryParameters,
93
+ ...remainingProperties.tokenQueryParameters,
94
+ },
95
+ accountId: remainingProperties.account?.nativeAccountId,
96
+ };
97
+ return this.nativeBrokerPlugin.acquireTokenInteractive(brokerRequest, windowHandle);
98
+ }
99
+ const { verifier, challenge } = await this.cryptoProvider.generatePkceCodes();
100
+ const loopbackClient = customLoopbackClient || new LoopbackClient();
101
+ const authCodeListener = loopbackClient.listenForAuthCode(successTemplate, errorTemplate);
102
+ const redirectUri = loopbackClient.getRedirectUri();
103
+ const validRequest = {
104
+ ...remainingProperties,
105
+ correlationId: correlationId,
106
+ scopes: request.scopes || OIDC_DEFAULT_SCOPES,
107
+ redirectUri: redirectUri,
108
+ responseMode: ResponseMode.QUERY,
109
+ codeChallenge: challenge,
110
+ codeChallengeMethod: CodeChallengeMethodValues.S256,
111
+ };
112
+ const authCodeUrl = await this.getAuthCodeUrl(validRequest);
113
+ await openBrowser(authCodeUrl);
114
+ const authCodeResponse = await authCodeListener.finally(() => {
115
+ loopbackClient.closeServer();
116
+ });
117
+ if (authCodeResponse.error) {
118
+ throw new ServerError(authCodeResponse.error, authCodeResponse.error_description, authCodeResponse.suberror);
119
+ }
120
+ else if (!authCodeResponse.code) {
121
+ throw NodeAuthError.createNoAuthCodeInResponseError();
122
+ }
123
+ const clientInfo = authCodeResponse.client_info;
124
+ const tokenRequest = {
125
+ code: authCodeResponse.code,
126
+ codeVerifier: verifier,
127
+ clientInfo: clientInfo || Constants$1.EMPTY_STRING,
128
+ ...validRequest,
129
+ };
130
+ return this.acquireTokenByCode(tokenRequest);
131
+ }
132
+ /**
133
+ * Returns a token retrieved either from the cache or by exchanging the refresh token for a fresh access token. If brokering is enabled the token request will be serviced by the broker.
134
+ * @param request
135
+ * @returns
136
+ */
137
+ async acquireTokenSilent(request) {
138
+ const correlationId = request.correlationId || this.cryptoProvider.createNewGuid();
139
+ this.logger.trace("acquireTokenSilent called", correlationId);
140
+ if (this.nativeBrokerPlugin) {
141
+ const brokerRequest = {
142
+ ...request,
143
+ clientId: this.config.auth.clientId,
144
+ scopes: request.scopes || OIDC_DEFAULT_SCOPES,
145
+ redirectUri: `${Constants.HTTP_PROTOCOL}${Constants.LOCALHOST}`,
146
+ authority: request.authority || this.config.auth.authority,
147
+ correlationId: correlationId,
148
+ extraParameters: request.tokenQueryParameters,
149
+ accountId: request.account.nativeAccountId,
150
+ forceRefresh: request.forceRefresh || false,
151
+ };
152
+ return this.nativeBrokerPlugin.acquireTokenSilent(brokerRequest);
153
+ }
154
+ return super.acquireTokenSilent(request);
155
+ }
156
+ /**
157
+ * Removes cache artifacts associated with the given account
158
+ * @param request
159
+ * @returns
160
+ */
161
+ async signOut(request) {
162
+ if (this.nativeBrokerPlugin && request.account.nativeAccountId) {
163
+ const signoutRequest = {
164
+ clientId: this.config.auth.clientId,
165
+ accountId: request.account.nativeAccountId,
166
+ correlationId: request.correlationId ||
167
+ this.cryptoProvider.createNewGuid(),
168
+ };
169
+ await this.nativeBrokerPlugin.signOut(signoutRequest);
170
+ }
171
+ await this.getTokenCache().removeAccount(request.account);
172
+ }
173
+ /**
174
+ * Returns all cached accounts for this application. If brokering is enabled this request will be serviced by the broker.
175
+ * @returns
176
+ */
177
+ async getAllAccounts() {
178
+ if (this.nativeBrokerPlugin) {
179
+ const correlationId = this.cryptoProvider.createNewGuid();
180
+ return this.nativeBrokerPlugin.getAllAccounts(this.config.auth.clientId, correlationId);
181
+ }
182
+ return this.getTokenCache().getAllAccounts();
183
+ }
184
184
  }
185
185
 
186
186
  export { PublicClientApplication };