@microsoft/teamsfx 0.3.3-alpha.3dc53ce2.0 → 0.3.3-alpha.5cb301a1.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 (68) hide show
  1. package/README.md +2 -2
  2. package/dist/index.esm2017.js +1413 -0
  3. package/dist/index.esm2017.js.map +1 -0
  4. package/dist/{index.js → index.esm2017.mjs} +1467 -1506
  5. package/dist/index.esm2017.mjs.map +1 -0
  6. package/dist/index.esm5.js +1575 -0
  7. package/dist/index.esm5.js.map +1 -0
  8. package/dist/index.node.cjs.js +1653 -0
  9. package/dist/index.node.cjs.js.map +1 -0
  10. package/package.json +58 -78
  11. package/types/teamsfx.d.ts +0 -2
  12. package/dist/index.js.map +0 -1
  13. package/dist/teamsfx.js +0 -30
  14. package/dist/teamsfx.js.map +0 -1
  15. package/dist-esm/src/bot/teamsBotSsoPrompt.browser.js +0 -118
  16. package/dist-esm/src/bot/teamsBotSsoPrompt.browser.js.map +0 -1
  17. package/dist-esm/src/bot/teamsBotSsoPrompt.js +0 -349
  18. package/dist-esm/src/bot/teamsBotSsoPrompt.js.map +0 -1
  19. package/dist-esm/src/bot/teamsBotSsoPromptTokenResponse.js +0 -2
  20. package/dist-esm/src/bot/teamsBotSsoPromptTokenResponse.js.map +0 -1
  21. package/dist-esm/src/core/cache.browser.js +0 -22
  22. package/dist-esm/src/core/cache.browser.js.map +0 -1
  23. package/dist-esm/src/core/cache.js +0 -28
  24. package/dist-esm/src/core/cache.js.map +0 -1
  25. package/dist-esm/src/core/configurationProvider.js +0 -124
  26. package/dist-esm/src/core/configurationProvider.js.map +0 -1
  27. package/dist-esm/src/core/defaultTediousConnectionConfiguration.browser.js +0 -28
  28. package/dist-esm/src/core/defaultTediousConnectionConfiguration.browser.js.map +0 -1
  29. package/dist-esm/src/core/defaultTediousConnectionConfiguration.js +0 -182
  30. package/dist-esm/src/core/defaultTediousConnectionConfiguration.js.map +0 -1
  31. package/dist-esm/src/core/errors.js +0 -97
  32. package/dist-esm/src/core/errors.js.map +0 -1
  33. package/dist-esm/src/core/msGraphAuthProvider.js +0 -68
  34. package/dist-esm/src/core/msGraphAuthProvider.js.map +0 -1
  35. package/dist-esm/src/core/msGraphClientProvider.js +0 -65
  36. package/dist-esm/src/core/msGraphClientProvider.js.map +0 -1
  37. package/dist-esm/src/credential/m365TenantCredential.browser.js +0 -38
  38. package/dist-esm/src/credential/m365TenantCredential.browser.js.map +0 -1
  39. package/dist-esm/src/credential/m365TenantCredential.js +0 -126
  40. package/dist-esm/src/credential/m365TenantCredential.js.map +0 -1
  41. package/dist-esm/src/credential/onBehalfOfUserCredential.browser.js +0 -46
  42. package/dist-esm/src/credential/onBehalfOfUserCredential.browser.js.map +0 -1
  43. package/dist-esm/src/credential/onBehalfOfUserCredential.js +0 -178
  44. package/dist-esm/src/credential/onBehalfOfUserCredential.js.map +0 -1
  45. package/dist-esm/src/credential/teamsUserCredential.browser.js +0 -462
  46. package/dist-esm/src/credential/teamsUserCredential.browser.js.map +0 -1
  47. package/dist-esm/src/credential/teamsUserCredential.js +0 -56
  48. package/dist-esm/src/credential/teamsUserCredential.js.map +0 -1
  49. package/dist-esm/src/index.js +0 -14
  50. package/dist-esm/src/index.js.map +0 -1
  51. package/dist-esm/src/models/accessTokenResult.js +0 -4
  52. package/dist-esm/src/models/accessTokenResult.js.map +0 -1
  53. package/dist-esm/src/models/authCodeResult.js +0 -4
  54. package/dist-esm/src/models/authCodeResult.js.map +0 -1
  55. package/dist-esm/src/models/configuration.js +0 -20
  56. package/dist-esm/src/models/configuration.js.map +0 -1
  57. package/dist-esm/src/models/grantType.js +0 -11
  58. package/dist-esm/src/models/grantType.js.map +0 -1
  59. package/dist-esm/src/models/ssoTokenInfo.js +0 -4
  60. package/dist-esm/src/models/ssoTokenInfo.js.map +0 -1
  61. package/dist-esm/src/models/userinfo.js +0 -4
  62. package/dist-esm/src/models/userinfo.js.map +0 -1
  63. package/dist-esm/src/util/logger.js +0 -134
  64. package/dist-esm/src/util/logger.js.map +0 -1
  65. package/dist-esm/src/util/utils.js +0 -130
  66. package/dist-esm/src/util/utils.js.map +0 -1
  67. package/dist-esm/src/util/utils.node.js +0 -23
  68. package/dist-esm/src/util/utils.node.js.map +0 -1
@@ -1,462 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { __awaiter } from "tslib";
4
- import { ErrorCode, ErrorMessage, ErrorWithCode } from "../core/errors";
5
- import { Cache } from "../core/cache.browser";
6
- import * as microsoftTeams from "@microsoft/teams-js";
7
- import { getAuthenticationConfiguration } from "../core/configurationProvider";
8
- import axios from "axios";
9
- import { GrantType } from "../models/grantType";
10
- import { validateScopesType, getUserInfoFromSsoToken, parseJwt } from "../util/utils";
11
- import { formatString } from "../util/utils";
12
- import { internalLogger } from "../util/logger";
13
- const accessTokenCacheKeyPrefix = "accessToken";
14
- const separator = "-";
15
- const tokenRefreshTimeSpanInMillisecond = 5 * 60 * 1000;
16
- const initializeTeamsSdkTimeoutInMillisecond = 5000;
17
- const loginPageWidth = 600;
18
- const loginPageHeight = 535;
19
- const maxRetryCount = 3;
20
- const retryTimeSpanInMillisecond = 3000;
21
- /**
22
- * Represent Teams current user's identity, and it is used within Teams tab application.
23
- *
24
- * @remarks
25
- * Can only be used within Teams.
26
- *
27
- * @beta
28
- */
29
- export class TeamsUserCredential {
30
- /**
31
- * Constructor of TeamsUserCredential.
32
- * Developer need to call loadConfiguration(config) before using this class.
33
- *
34
- * @example
35
- * ```typescript
36
- * const config = {
37
- * authentication: {
38
- * runtimeConnectorEndpoint: "https://xxx.xxx.com",
39
- * initiateLoginEndpoint: "https://localhost:3000/auth-start.html",
40
- * clientId: "xxx"
41
- * }
42
- * }
43
- loadConfiguration(config); // No default config from environment variables, developers must provide the config object.
44
- const credential = new TeamsUserCredential(["https://graph.microsoft.com/User.Read"]);
45
- * ```
46
- *
47
- * @throws {@link ErrorCode|InvalidConfiguration} when client id, initiate login endpoint or simple auth endpoint is not found in config.
48
- * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
49
- *
50
- * @beta
51
- */
52
- constructor() {
53
- internalLogger.info("Create teams user credential");
54
- this.config = this.loadAndValidateConfig();
55
- this.ssoToken = null;
56
- }
57
- /**
58
- * Popup login page to get user's access token with specific scopes.
59
- *
60
- * @remarks
61
- * Only works in Teams client APP. User will be redirected to the authorization page to login and consent.
62
- *
63
- * @example
64
- * ```typescript
65
- * await credential.login(["https://graph.microsoft.com/User.Read"]); // single scope using string array
66
- * await credential.login("https://graph.microsoft.com/User.Read"); // single scopes using string
67
- * await credential.login(["https://graph.microsoft.com/User.Read", "Calendars.Read"]); // multiple scopes using string array
68
- * await credential.login("https://graph.microsoft.com/User.Read Calendars.Read"); // multiple scopes using string
69
- * ```
70
- * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.
71
- *
72
- * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.
73
- * @throws {@link ErrorCode|ServiceError} when simple auth server failed to exchange access token.
74
- * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
75
- * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
76
- * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
77
- *
78
- * @beta
79
- */
80
- login(scopes) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- validateScopesType(scopes);
83
- const scopesStr = typeof scopes === "string" ? scopes : scopes.join(" ");
84
- internalLogger.info(`Popup login page to get user's access token with scopes: ${scopesStr}`);
85
- return new Promise((resolve, reject) => {
86
- microsoftTeams.initialize(() => {
87
- microsoftTeams.authentication.authenticate({
88
- url: `${this.config.initiateLoginEndpoint}?clientId=${this.config.clientId}&scope=${encodeURI(scopesStr)}`,
89
- width: loginPageWidth,
90
- height: loginPageHeight,
91
- successCallback: (result) => __awaiter(this, void 0, void 0, function* () {
92
- if (!result) {
93
- const errorMsg = "Get empty authentication result from Teams";
94
- internalLogger.error(errorMsg);
95
- reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));
96
- return;
97
- }
98
- const authCodeResult = JSON.parse(result);
99
- try {
100
- yield this.exchangeAccessTokenFromSimpleAuthServer(scopesStr, authCodeResult);
101
- resolve();
102
- }
103
- catch (err) {
104
- reject(this.generateAuthServerError(err));
105
- }
106
- }),
107
- failureCallback: (reason) => {
108
- const errorMsg = `Consent failed for the scope ${scopesStr} with error: ${reason}`;
109
- internalLogger.error(errorMsg);
110
- reject(new ErrorWithCode(errorMsg, ErrorCode.ConsentFailed));
111
- },
112
- });
113
- });
114
- });
115
- });
116
- }
117
- /**
118
- * Get access token from credential.
119
- *
120
- * @example
121
- * ```typescript
122
- * await credential.getToken([]) // Get SSO token using empty string array
123
- * await credential.getToken("") // Get SSO token using empty string
124
- * await credential.getToken([".default"]) // Get Graph access token with default scope using string array
125
- * await credential.getToken(".default") // Get Graph access token with default scope using string
126
- * await credential.getToken(["User.Read"]) // Get Graph access token for single scope using string array
127
- * await credential.getToken("User.Read") // Get Graph access token for single scope using string
128
- * await credential.getToken(["User.Read", "Application.Read.All"]) // Get Graph access token for multiple scopes using string array
129
- * await credential.getToken("User.Read Application.Read.All") // Get Graph access token for multiple scopes using space-separated string
130
- * await credential.getToken("https://graph.microsoft.com/User.Read") // Get Graph access token with full resource URI
131
- * await credential.getToken(["https://outlook.office.com/Mail.Read"]) // Get Outlook access token
132
- * ```
133
- *
134
- * @param {string | string[]} scopes - The list of scopes for which the token will have access.
135
- * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.
136
- *
137
- * @throws {@link ErrorCode|InternalError} when failed to get access token with unknown error.
138
- * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.
139
- * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth server.
140
- * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
141
- * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
142
- *
143
- * @returns User access token of defined scopes.
144
- * If scopes is empty string or array, it returns SSO token.
145
- * If scopes is non-empty, it returns access token for target scope.
146
- * Throw error if get access token failed.
147
- *
148
- * @beta
149
- */
150
- getToken(scopes, options) {
151
- return __awaiter(this, void 0, void 0, function* () {
152
- validateScopesType(scopes);
153
- const ssoToken = yield this.getSSOToken();
154
- const scopeStr = typeof scopes === "string" ? scopes : scopes.join(" ");
155
- if (scopeStr === "") {
156
- internalLogger.info("Get SSO token");
157
- return ssoToken;
158
- }
159
- else {
160
- internalLogger.info("Get access token with scopes: " + scopeStr);
161
- const cachedKey = yield this.getAccessTokenCacheKey(scopeStr);
162
- const cachedToken = this.getTokenCache(cachedKey);
163
- if (cachedToken) {
164
- if (!this.isAccessTokenNearExpired(cachedToken)) {
165
- internalLogger.verbose("Get access token from cache");
166
- return cachedToken;
167
- }
168
- else {
169
- internalLogger.verbose("Cached access token is expired");
170
- }
171
- }
172
- else {
173
- internalLogger.verbose("No cached access token");
174
- }
175
- const accessToken = yield this.getAndCacheAccessTokenFromSimpleAuthServer(scopeStr);
176
- return accessToken;
177
- }
178
- });
179
- }
180
- /**
181
- * Get basic user info from SSO token
182
- *
183
- * @example
184
- * ```typescript
185
- * const currentUser = await credential.getUserInfo();
186
- * ```
187
- *
188
- * @throws {@link ErrorCode|InternalError} when SSO token from Teams client is not valid.
189
- * @throws {@link ErrorCode|InvalidParameter} when SSO token from Teams client is empty.
190
- * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
191
- *
192
- * @returns Basic user info with user displayName, objectId and preferredUserName.
193
- *
194
- * @beta
195
- */
196
- getUserInfo() {
197
- return __awaiter(this, void 0, void 0, function* () {
198
- internalLogger.info("Get basic user info from SSO token");
199
- const ssoToken = yield this.getSSOToken();
200
- return getUserInfoFromSsoToken(ssoToken.token);
201
- });
202
- }
203
- exchangeAccessTokenFromSimpleAuthServer(scopesStr, authCodeResult) {
204
- var _a, _b;
205
- return __awaiter(this, void 0, void 0, function* () {
206
- const axiosInstance = yield this.getAxiosInstance();
207
- let retryCount = 0;
208
- while (true) {
209
- try {
210
- const response = yield axiosInstance.post("/auth/token", {
211
- scope: scopesStr,
212
- code: authCodeResult.code,
213
- code_verifier: authCodeResult.codeVerifier,
214
- redirect_uri: authCodeResult.redirectUri,
215
- grant_type: GrantType.authCode,
216
- });
217
- const tokenResult = response.data;
218
- const key = yield this.getAccessTokenCacheKey(scopesStr);
219
- this.setTokenCache(key, {
220
- token: tokenResult.access_token,
221
- expiresOnTimestamp: tokenResult.expires_on,
222
- });
223
- return;
224
- }
225
- catch (err) {
226
- if (((_b = (_a = err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.type) && err.response.data.type === "AadUiRequiredException") {
227
- internalLogger.warn("Exchange access token failed, retry...");
228
- if (retryCount < maxRetryCount) {
229
- yield this.sleep(retryTimeSpanInMillisecond);
230
- retryCount++;
231
- continue;
232
- }
233
- }
234
- throw err;
235
- }
236
- }
237
- });
238
- }
239
- /**
240
- * Get access token cache from authentication server
241
- * @returns Access token
242
- */
243
- getAndCacheAccessTokenFromSimpleAuthServer(scopesStr) {
244
- return __awaiter(this, void 0, void 0, function* () {
245
- try {
246
- internalLogger.verbose("Get access token from authentication server with scopes: " + scopesStr);
247
- const axiosInstance = yield this.getAxiosInstance();
248
- const response = yield axiosInstance.post("/auth/token", {
249
- scope: scopesStr,
250
- grant_type: GrantType.ssoToken,
251
- });
252
- const accessTokenResult = response.data;
253
- const accessToken = {
254
- token: accessTokenResult.access_token,
255
- expiresOnTimestamp: accessTokenResult.expires_on,
256
- };
257
- const cacheKey = yield this.getAccessTokenCacheKey(scopesStr);
258
- this.setTokenCache(cacheKey, accessToken);
259
- return accessToken;
260
- }
261
- catch (err) {
262
- throw this.generateAuthServerError(err);
263
- }
264
- });
265
- }
266
- /**
267
- * Get SSO token using teams SDK
268
- * It will try to get SSO token from memory first, if SSO token doesn't exist or about to expired, then it will using teams SDK to get SSO token
269
- * @returns SSO token
270
- */
271
- getSSOToken() {
272
- return new Promise((resolve, reject) => {
273
- if (this.ssoToken) {
274
- if (this.ssoToken.expiresOnTimestamp - Date.now() > tokenRefreshTimeSpanInMillisecond) {
275
- internalLogger.verbose("Get SSO token from memory cache");
276
- resolve(this.ssoToken);
277
- return;
278
- }
279
- }
280
- let initialized = false;
281
- microsoftTeams.initialize(() => {
282
- initialized = true;
283
- microsoftTeams.authentication.getAuthToken({
284
- successCallback: (token) => {
285
- if (!token) {
286
- const errorMsg = "Get empty SSO token from Teams";
287
- internalLogger.error(errorMsg);
288
- reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));
289
- return;
290
- }
291
- const tokenObject = parseJwt(token);
292
- if (tokenObject.ver !== "1.0" && tokenObject.ver !== "2.0") {
293
- const errorMsg = "SSO token is not valid with an unknown version: " + tokenObject.ver;
294
- internalLogger.error(errorMsg);
295
- reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));
296
- return;
297
- }
298
- const ssoToken = {
299
- token,
300
- expiresOnTimestamp: tokenObject.exp * 1000,
301
- };
302
- this.ssoToken = ssoToken;
303
- resolve(ssoToken);
304
- },
305
- failureCallback: (errMessage) => {
306
- const errorMsg = "Get SSO token failed with error: " + errMessage;
307
- internalLogger.error(errorMsg);
308
- reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));
309
- },
310
- resources: [],
311
- });
312
- });
313
- // If the code not running in Teams, the initialize callback function would never trigger
314
- setTimeout(() => {
315
- if (!initialized) {
316
- const errorMsg = "Initialize teams sdk timeout, maybe the code is not running inside Teams";
317
- internalLogger.error(errorMsg);
318
- reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));
319
- }
320
- }, initializeTeamsSdkTimeoutInMillisecond);
321
- });
322
- }
323
- /**
324
- * Load and validate authentication configuration
325
- * @returns Authentication configuration
326
- */
327
- loadAndValidateConfig() {
328
- internalLogger.verbose("Validate authentication configuration");
329
- const config = getAuthenticationConfiguration();
330
- if (!config) {
331
- internalLogger.error(ErrorMessage.AuthenticationConfigurationNotExists);
332
- throw new ErrorWithCode(ErrorMessage.AuthenticationConfigurationNotExists, ErrorCode.InvalidConfiguration);
333
- }
334
- if (config.initiateLoginEndpoint && config.simpleAuthEndpoint && config.clientId) {
335
- return config;
336
- }
337
- const missingValues = [];
338
- if (!config.initiateLoginEndpoint) {
339
- missingValues.push("initiateLoginEndpoint");
340
- }
341
- if (!config.simpleAuthEndpoint) {
342
- missingValues.push("simpleAuthEndpoint");
343
- }
344
- if (!config.clientId) {
345
- missingValues.push("clientId");
346
- }
347
- const errorMsg = formatString(ErrorMessage.InvalidConfiguration, missingValues.join(", "), "undefined");
348
- internalLogger.error(errorMsg);
349
- throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);
350
- }
351
- /**
352
- * Get axios instance with sso token bearer header
353
- * @returns AxiosInstance
354
- */
355
- getAxiosInstance() {
356
- return __awaiter(this, void 0, void 0, function* () {
357
- const ssoToken = yield this.getSSOToken();
358
- const axiosInstance = axios.create({
359
- baseURL: this.config.simpleAuthEndpoint,
360
- });
361
- axiosInstance.interceptors.request.use((config) => {
362
- config.headers.Authorization = "Bearer " + ssoToken.token;
363
- return config;
364
- });
365
- return axiosInstance;
366
- });
367
- }
368
- /**
369
- * Set access token to cache
370
- * @param key
371
- * @param token
372
- */
373
- setTokenCache(key, token) {
374
- Cache.set(key, JSON.stringify(token));
375
- }
376
- /**
377
- * Get access token from cache.
378
- * If there is no cache or cannot be parsed, then it will return null
379
- * @param key
380
- * @returns Access token or null
381
- */
382
- getTokenCache(key) {
383
- const value = Cache.get(key);
384
- if (value === null) {
385
- return null;
386
- }
387
- const accessToken = this.validateAndParseJson(value);
388
- return accessToken;
389
- }
390
- /**
391
- * Parses passed value as JSON access token, if value is not a valid json string JSON.parse() will throw an error.
392
- * @param jsonValue
393
- */
394
- validateAndParseJson(jsonValue) {
395
- try {
396
- const parsedJson = JSON.parse(jsonValue);
397
- /**
398
- * There are edge cases in which JSON.parse will successfully parse a non-valid JSON object
399
- * (e.g. JSON.parse will parse an escaped string into an unescaped string), so adding a type check
400
- * of the parsed value is necessary in order to be certain that the string represents a valid JSON object.
401
- *
402
- */
403
- return parsedJson && typeof parsedJson === "object" ? parsedJson : null;
404
- }
405
- catch (error) {
406
- return null;
407
- }
408
- }
409
- /**
410
- * Generate cache key
411
- * @param scopesStr
412
- * @returns Access token cache key, a key example: accessToken-userId-clientId-tenantId-scopes
413
- */
414
- getAccessTokenCacheKey(scopesStr) {
415
- return __awaiter(this, void 0, void 0, function* () {
416
- const ssoToken = yield this.getSSOToken();
417
- const ssoTokenObj = parseJwt(ssoToken.token);
418
- const clientId = this.config.clientId;
419
- const userObjectId = ssoTokenObj.oid;
420
- const tenantId = ssoTokenObj.tid;
421
- const key = [accessTokenCacheKeyPrefix, userObjectId, clientId, tenantId, scopesStr]
422
- .join(separator)
423
- .replace(/" "/g, "_");
424
- return key;
425
- });
426
- }
427
- /**
428
- * Check whether the token is about to expire (within 5 minutes)
429
- * @returns Boolean value indicate whether the token is about to expire
430
- */
431
- isAccessTokenNearExpired(token) {
432
- const expireDate = new Date(token.expiresOnTimestamp);
433
- if (expireDate.getTime() - Date.now() > tokenRefreshTimeSpanInMillisecond) {
434
- return false;
435
- }
436
- return true;
437
- }
438
- generateAuthServerError(err) {
439
- var _a, _b;
440
- let errorMessage = err.message;
441
- if ((_b = (_a = err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.type) {
442
- errorMessage = err.response.data.detail;
443
- if (err.response.data.type === "AadUiRequiredException") {
444
- const fullErrorMsg = "Failed to get access token from authentication server, please login first: " +
445
- errorMessage;
446
- internalLogger.warn(fullErrorMsg);
447
- return new ErrorWithCode(fullErrorMsg, ErrorCode.UiRequiredError);
448
- }
449
- else {
450
- const fullErrorMsg = "Failed to get access token from authentication server: " + errorMessage;
451
- internalLogger.error(fullErrorMsg);
452
- return new ErrorWithCode(fullErrorMsg, ErrorCode.ServiceError);
453
- }
454
- }
455
- const fullErrorMsg = "Failed to get access token with error: " + errorMessage;
456
- return new ErrorWithCode(fullErrorMsg, ErrorCode.InternalError);
457
- }
458
- sleep(ms) {
459
- return new Promise((resolve) => setTimeout(resolve, ms));
460
- }
461
- }
462
- //# sourceMappingURL=teamsUserCredential.browser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"teamsUserCredential.browser.js","sourceRoot":"","sources":["../../../src/credential/teamsUserCredential.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAIlC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAG/E,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,yBAAyB,GAAG,aAAa,CAAC;AAChD,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,iCAAiC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACxD,MAAM,sCAAsC,GAAG,IAAI,CAAC;AACpD,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAmB;IAI9B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH;QACE,cAAc,CAAC,IAAI,CAAC,8B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AAI,UAAU,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,iCAAiC,EAAE;YACzE,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,uBAAuB,CAAC,GAAQ;;QACtC,IAAI,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC;QAC/B,IAAI,MAAA,MAAA,GAAG,CAAC,QAAQ,0CAAE,IAAI,0CAAE,IAAI,EAAE;YAC5B,YAAY,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;YACxC,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,wBAAwB,EAAE;gBACvD,MAAM,YAAY,GAChB,6EAA6E;oBAC7E,YAAY,CAAC;gBACf,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBAClC,OAAO,IAAI,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;aACnE;iBAAM;gBACL,MAAM,YAAY,GAChB,yDAAyD,GAAG,YAAY,CAAC;gBAC3E,cAAc,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;gBACnC,OAAO,IAAI,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;aAChE;SACF;QAED,MAAM,YAAY,GAAG,yCAAyC,GAAG,YAAY,CAAC;QAC9E,OAAO,IAAI,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IAClE,CAAC;IAEO,KAAK,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\nimport { Cache } from \"../core/cache.browser\";\nimport * as microsoftTeams from \"@microsoft/teams-js\";\nimport { getAuthenticationConfiguration } from \"../core/configurationProvider\";\nimport { AuthenticationConfiguration } from \"../models/configuration\";\nimport { AuthCodeResult } from \"../models/authCodeResult\";\nimport axios, { AxiosInstance } from \"axios\";\nimport { GrantType } from \"../models/grantType\";\nimport { AccessTokenResult } from \"../models/accessTokenResult\";\nimport { validateScopesType, getUserInfoFromSsoToken, parseJwt } from \"../util/utils\";\nimport { formatString } from \"../util/utils\";\nimport { internalLogger } from \"../util/logger\";\n\nconst accessTokenCacheKeyPrefix = \"accessToken\";\nconst separator = \"-\";\nconst tokenRefreshTimeSpanInMillisecond = 5 * 60 * 1000;\nconst initializeTeamsSdkTimeoutInMillisecond = 5000;\nconst loginPageWidth = 600;\nconst loginPageHeight = 535;\nconst maxRetryCount = 3;\nconst retryTimeSpanInMillisecond = 3000;\n\n/**\n * Represent Teams current user's identity, and it is used within Teams tab application.\n *\n * @remarks\n * Can only be used within Teams.\n *\n * @beta\n */\nexport class TeamsUserCredential implements TokenCredential {\n private readonly config: AuthenticationConfiguration;\n private ssoToken: AccessToken | null;\n\n /**\n * Constructor of TeamsUserCredential.\n * Developer need to call loadConfiguration(config) before using this class.\n * \n * @example\n * ```typescript\n * const config = {\n * authentication: {\n * runtimeConnectorEndpoint: \"https://xxx.xxx.com\",\n * initiateLoginEndpoint: \"https://localhost:3000/auth-start.html\",\n * clientId: \"xxx\"\n * }\n * }\n loadConfiguration(config); // No default config from environment variables, developers must provide the config object.\n const credential = new TeamsUserCredential([\"https://graph.microsoft.com/User.Read\"]);\n * ```\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when client id, initiate login endpoint or simple auth endpoint is not found in config.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n * \n * @beta\n */\n constructor() {\n internalLogger.info(\"Create teams user credential\");\n this.config = this.loadAndValidateConfig();\n this.ssoToken = null;\n }\n\n /**\n * Popup login page to get user's access token with specific scopes.\n *\n * @remarks\n * Only works in Teams client APP. User will be redirected to the authorization page to login and consent.\n *\n * @example\n * ```typescript\n * await credential.login([\"https://graph.microsoft.com/User.Read\"]); // single scope using string array\n * await credential.login(\"https://graph.microsoft.com/User.Read\"); // single scopes using string\n * await credential.login([\"https://graph.microsoft.com/User.Read\", \"Calendars.Read\"]); // multiple scopes using string array\n * await credential.login(\"https://graph.microsoft.com/User.Read Calendars.Read\"); // multiple scopes using string\n * ```\n * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.\n *\n * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.\n * @throws {@link ErrorCode|ServiceError} when simple auth server failed to exchange access token.\n * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @beta\n */\n public async login(scopes: string | string[]): Promise<void> {\n validateScopesType(scopes);\n const scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n\n internalLogger.info(`Popup login page to get user's access token with scopes: ${scopesStr}`);\n\n return new Promise<void>((resolve, reject) => {\n microsoftTeams.initialize(() => {\n microsoftTeams.authentication.authenticate({\n url: `${this.config.initiateLoginEndpoint}?clientId=${\n this.config.clientId\n }&scope=${encodeURI(scopesStr)}`,\n width: loginPageWidth,\n height: loginPageHeight,\n successCallback: async (result?: string) => {\n if (!result) {\n const errorMsg = \"Get empty authentication result from Teams\";\n\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const authCodeResult: AuthCodeResult = JSON.parse(result);\n try {\n await this.exchangeAccessTokenFromSimpleAuthServer(scopesStr, authCodeResult);\n resolve();\n } catch (err) {\n reject(this.generateAuthServerError(err));\n }\n },\n failureCallback: (reason?: string) => {\n const errorMsg = `Consent failed for the scope ${scopesStr} with error: ${reason}`;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.ConsentFailed));\n },\n });\n });\n });\n }\n\n /**\n * Get access token from credential.\n *\n * @example\n * ```typescript\n * await credential.getToken([]) // Get SSO token using empty string array\n * await credential.getToken(\"\") // Get SSO token using empty string\n * await credential.getToken([\".default\"]) // Get Graph access token with default scope using string array\n * await credential.getToken(\".default\") // Get Graph access token with default scope using string\n * await credential.getToken([\"User.Read\"]) // Get Graph access token for single scope using string array\n * await credential.getToken(\"User.Read\") // Get Graph access token for single scope using string\n * await credential.getToken([\"User.Read\", \"Application.Read.All\"]) // Get Graph access token for multiple scopes using string array\n * await credential.getToken(\"User.Read Application.Read.All\") // Get Graph access token for multiple scopes using space-separated string\n * await credential.getToken(\"https://graph.microsoft.com/User.Read\") // Get Graph access token with full resource URI\n * await credential.getToken([\"https://outlook.office.com/Mail.Read\"]) // Get Outlook access token\n * ```\n *\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.\n *\n * @throws {@link ErrorCode|InternalError} when failed to get access token with unknown error.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth server.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns User access token of defined scopes.\n * If scopes is empty string or array, it returns SSO token.\n * If scopes is non-empty, it returns access token for target scope.\n * Throw error if get access token failed.\n *\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n validateScopesType(scopes);\n const ssoToken = await this.getSSOToken();\n\n const scopeStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n if (scopeStr === \"\") {\n internalLogger.info(\"Get SSO token\");\n\n return ssoToken;\n } else {\n internalLogger.info(\"Get access token with scopes: \" + scopeStr);\n const cachedKey = await this.getAccessTokenCacheKey(scopeStr);\n const cachedToken = this.getTokenCache(cachedKey);\n\n if (cachedToken) {\n if (!this.isAccessTokenNearExpired(cachedToken)) {\n internalLogger.verbose(\"Get access token from cache\");\n return cachedToken;\n } else {\n internalLogger.verbose(\"Cached access token is expired\");\n }\n } else {\n internalLogger.verbose(\"No cached access token\");\n }\n\n const accessToken = await this.getAndCacheAccessTokenFromSimpleAuthServer(scopeStr);\n return accessToken;\n }\n }\n\n /**\n * Get basic user info from SSO token\n *\n * @example\n * ```typescript\n * const currentUser = await credential.getUserInfo();\n * ```\n *\n * @throws {@link ErrorCode|InternalError} when SSO token from Teams client is not valid.\n * @throws {@link ErrorCode|InvalidParameter} when SSO token from Teams client is empty.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns Basic user info with user displayName, objectId and preferredUserName.\n *\n * @beta\n */\n public async getUserInfo(): Promise<UserInfo> {\n internalLogger.info(\"Get basic user info from SSO token\");\n const ssoToken = await this.getSSOToken();\n return getUserInfoFromSsoToken(ssoToken.token);\n }\n\n private async exchangeAccessTokenFromSimpleAuthServer(\n scopesStr: string,\n authCodeResult: AuthCodeResult\n ): Promise<void> {\n const axiosInstance: AxiosInstance = await this.getAxiosInstance();\n\n let retryCount = 0;\n while (true) {\n try {\n const response = await axiosInstance.post(\"/auth/token\", {\n scope: scopesStr,\n code: authCodeResult.code,\n code_verifier: authCodeResult.codeVerifier,\n redirect_uri: authCodeResult.redirectUri,\n grant_type: GrantType.authCode,\n });\n\n const tokenResult: AccessTokenResult = response.data;\n const key = await this.getAccessTokenCacheKey(scopesStr);\n this.setTokenCache(key, {\n token: tokenResult.access_token,\n expiresOnTimestamp: tokenResult.expires_on,\n });\n return;\n } catch (err: any) {\n if (err.response?.data?.type && err.response.data.type === \"AadUiRequiredException\") {\n internalLogger.warn(\"Exchange access token failed, retry...\");\n if (retryCount < maxRetryCount) {\n await this.sleep(retryTimeSpanInMillisecond);\n retryCount++;\n continue;\n }\n }\n throw err;\n }\n }\n }\n\n /**\n * Get access token cache from authentication server\n * @returns Access token\n */\n private async getAndCacheAccessTokenFromSimpleAuthServer(\n scopesStr: string\n ): Promise<AccessToken> {\n try {\n internalLogger.verbose(\n \"Get access token from authentication server with scopes: \" + scopesStr\n );\n const axiosInstance: AxiosInstance = await this.getAxiosInstance();\n const response = await axiosInstance.post(\"/auth/token\", {\n scope: scopesStr,\n grant_type: GrantType.ssoToken,\n });\n\n const accessTokenResult: AccessTokenResult = response.data;\n const accessToken: AccessToken = {\n token: accessTokenResult.access_token,\n expiresOnTimestamp: accessTokenResult.expires_on,\n };\n const cacheKey = await this.getAccessTokenCacheKey(scopesStr);\n this.setTokenCache(cacheKey, accessToken);\n return accessToken;\n } catch (err) {\n throw this.generateAuthServerError(err);\n }\n }\n\n /**\n * Get SSO token using teams SDK\n * It will try to get SSO token from memory first, if SSO token doesn't exist or about to expired, then it will using teams SDK to get SSO token\n * @returns SSO token\n */\n private getSSOToken(): Promise<AccessToken> {\n return new Promise<AccessToken>((resolve, reject) => {\n if (this.ssoToken) {\n if (this.ssoToken.expiresOnTimestamp - Date.now() > tokenRefreshTimeSpanInMillisecond) {\n internalLogger.verbose(\"Get SSO token from memory cache\");\n resolve(this.ssoToken);\n return;\n }\n }\n\n let initialized = false;\n microsoftTeams.initialize(() => {\n initialized = true;\n microsoftTeams.authentication.getAuthToken({\n successCallback: (token: string) => {\n if (!token) {\n const errorMsg = \"Get empty SSO token from Teams\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const tokenObject = parseJwt(token);\n if (tokenObject.ver !== \"1.0\" && tokenObject.ver !== \"2.0\") {\n const errorMsg = \"SSO token is not valid with an unknown version: \" + tokenObject.ver;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const ssoToken: AccessToken = {\n token,\n expiresOnTimestamp: tokenObject.exp * 1000,\n };\n\n this.ssoToken = ssoToken;\n resolve(ssoToken);\n },\n failureCallback: (errMessage: string) => {\n const errorMsg = \"Get SSO token failed with error: \" + errMessage;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n },\n resources: [],\n });\n });\n\n // If the code not running in Teams, the initialize callback function would never trigger\n setTimeout(() => {\n if (!initialized) {\n const errorMsg =\n \"Initialize teams sdk timeout, maybe the code is not running inside Teams\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n }\n }, initializeTeamsSdkTimeoutInMillisecond);\n });\n }\n\n /**\n * Load and validate authentication configuration\n * @returns Authentication configuration\n */\n private loadAndValidateConfig(): AuthenticationConfiguration {\n internalLogger.verbose(\"Validate authentication configuration\");\n const config = getAuthenticationConfiguration();\n\n if (!config) {\n internalLogger.error(ErrorMessage.AuthenticationConfigurationNotExists);\n\n throw new ErrorWithCode(\n ErrorMessage.AuthenticationConfigurationNotExists,\n ErrorCode.InvalidConfiguration\n );\n }\n\n if (config.initiateLoginEndpoint && config.simpleAuthEndpoint && config.clientId) {\n return config;\n }\n\n const missingValues = [];\n if (!config.initiateLoginEndpoint) {\n missingValues.push(\"initiateLoginEndpoint\");\n }\n\n if (!config.simpleAuthEndpoint) {\n missingValues.push(\"simpleAuthEndpoint\");\n }\n\n if (!config.clientId) {\n missingValues.push(\"clientId\");\n }\n\n const errorMsg = formatString(\n ErrorMessage.InvalidConfiguration,\n missingValues.join(\", \"),\n \"undefined\"\n );\n\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n }\n\n /**\n * Get axios instance with sso token bearer header\n * @returns AxiosInstance\n */\n private async getAxiosInstance(): Promise<AxiosInstance> {\n const ssoToken = await this.getSSOToken();\n const axiosInstance: AxiosInstance = axios.create({\n baseURL: this.config.simpleAuthEndpoint,\n });\n\n axiosInstance.interceptors.request.use((config) => {\n config.headers!.Authorization = \"Bearer \" + ssoToken.token;\n return config;\n });\n\n return axiosInstance;\n }\n\n /**\n * Set access token to cache\n * @param key\n * @param token\n */\n private setTokenCache(key: string, token: AccessToken): void {\n Cache.set(key, JSON.stringify(token));\n }\n\n /**\n * Get access token from cache.\n * If there is no cache or cannot be parsed, then it will return null\n * @param key\n * @returns Access token or null\n */\n private getTokenCache(key: string): AccessToken | null {\n const value = Cache.get(key);\n if (value === null) {\n return null;\n }\n\n const accessToken: AccessToken | null = this.validateAndParseJson(value);\n return accessToken;\n }\n\n /**\n * Parses passed value as JSON access token, if value is not a valid json string JSON.parse() will throw an error.\n * @param jsonValue\n */\n private validateAndParseJson(jsonValue: string): AccessToken | null {\n try {\n const parsedJson = JSON.parse(jsonValue);\n /**\n * There are edge cases in which JSON.parse will successfully parse a non-valid JSON object\n * (e.g. JSON.parse will parse an escaped string into an unescaped string), so adding a type check\n * of the parsed value is necessary in order to be certain that the string represents a valid JSON object.\n *\n */\n return parsedJson && typeof parsedJson === \"object\" ? parsedJson : null;\n } catch (error) {\n return null;\n }\n }\n\n /**\n * Generate cache key\n * @param scopesStr\n * @returns Access token cache key, a key example: accessToken-userId-clientId-tenantId-scopes\n */\n private async getAccessTokenCacheKey(scopesStr: string): Promise<string> {\n const ssoToken = await this.getSSOToken();\n const ssoTokenObj = parseJwt(ssoToken.token);\n\n const clientId = this.config.clientId;\n const userObjectId = ssoTokenObj.oid;\n const tenantId = ssoTokenObj.tid;\n\n const key = [accessTokenCacheKeyPrefix, userObjectId, clientId, tenantId, scopesStr]\n .join(separator)\n .replace(/\" \"/g, \"_\");\n return key;\n }\n\n /**\n * Check whether the token is about to expire (within 5 minutes)\n * @returns Boolean value indicate whether the token is about to expire\n */\n private isAccessTokenNearExpired(token: AccessToken): boolean {\n const expireDate = new Date(token.expiresOnTimestamp);\n if (expireDate.getTime() - Date.now() > tokenRefreshTimeSpanInMillisecond) {\n return false;\n }\n return true;\n }\n\n private generateAuthServerError(err: any): Error {\n let errorMessage = err.message;\n if (err.response?.data?.type) {\n errorMessage = err.response.data.detail;\n if (err.response.data.type === \"AadUiRequiredException\") {\n const fullErrorMsg =\n \"Failed to get access token from authentication server, please login first: \" +\n errorMessage;\n internalLogger.warn(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.UiRequiredError);\n } else {\n const fullErrorMsg =\n \"Failed to get access token from authentication server: \" + errorMessage;\n internalLogger.error(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.ServiceError);\n }\n }\n\n const fullErrorMsg = \"Failed to get access token with error: \" + errorMessage;\n return new ErrorWithCode(fullErrorMsg, ErrorCode.InternalError);\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n"]}
@@ -1,56 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { __awaiter } from "tslib";
4
- import { ErrorWithCode, ErrorCode, ErrorMessage } from "../core/errors";
5
- import { formatString } from "../util/utils";
6
- /**
7
- * Represent Teams current user's identity, and it is used within Teams client applications.
8
- *
9
- * @remarks
10
- * Can only be used within Teams.
11
- *
12
- * @beta
13
- */
14
- export class TeamsUserCredential {
15
- /**
16
- * Constructor of TeamsUserCredential.
17
- * @remarks
18
- * Can only be used within Teams.
19
- * @beta
20
- */
21
- constructor() {
22
- throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "TeamsUserCredential"), ErrorCode.RuntimeNotSupported);
23
- }
24
- /**
25
- * Popup login page to get user's access token with specific scopes.
26
- * @remarks
27
- * Can only be used within Teams.
28
- * @beta
29
- */
30
- login(scopes) {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "TeamsUserCredential"), ErrorCode.RuntimeNotSupported);
33
- });
34
- }
35
- /**
36
- * Get access token from credential.
37
- * @remarks
38
- * Can only be used within Teams.
39
- * @beta
40
- */
41
- getToken(scopes, options) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "TeamsUserCredential"), ErrorCode.RuntimeNotSupported);
44
- });
45
- }
46
- /**
47
- * Get basic user info from SSO token
48
- * @remarks
49
- * Can only be used within Teams.
50
- * @beta
51
- */
52
- getUserInfo() {
53
- throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "TeamsUserCredential"), ErrorCode.RuntimeNotSupported);
54
- }
55
- }
56
- //# sourceMappingURL=teamsUserCredential.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"teamsUserCredential.js","sourceRoot":"","sources":["../../../src/credential/teamsUserCredential.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAIlC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAmB;IAC9B;;;;;OAKG;IACH;QACE,MAAM,IAAI,aAAa,CACrB,YAAY,CAAC,YAAY,CAAC,yBAAyB,EAAE,qBAAqB,CAAC,EAC3E,SAAS,CAAC,mBAAmB,CAC9B,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACU,KAAK,CAAC,MAAyB;;YAC1C,MAAM,IAAI,aAAa,CACrB,YAAY,CAAC,YAAY,CAAC,yBAAyB,EAAE,qBAAqB,CAAC,EAC3E,SAAS,CAAC,mBAAmB,CAC9B,CAAC;QACJ,CAAC;KAAA;IAED;;;;;OAKG;IACG,QAAQ,CACZ,MAAyB,EACzB,OAAyB;;YAEzB,MAAM,IAAI,aAAa,CACrB,YAAY,CAAC,YAAY,CAAC,yBAAyB,EAAE,qBAAqB,CAAC,EAC3E,SAAS,CAAC,mBAAmB,CAC9B,CAAC;QACJ,CAAC;KAAA;IAED;;;;;OAKG;IACI,WAAW;QAChB,MAAM,IAAI,aAAa,CACrB,YAAY,CAAC,YAAY,CAAC,yBAAyB,EAAE,qBAAqB,CAAC,EAC3E,SAAS,CAAC,mBAAmB,CAC9B,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Represent Teams current user's identity, and it is used within Teams client applications.\n *\n * @remarks\n * Can only be used within Teams.\n *\n * @beta\n */\nexport class TeamsUserCredential implements TokenCredential {\n /**\n * Constructor of TeamsUserCredential.\n * @remarks\n * Can only be used within Teams.\n * @beta\n */\n constructor() {\n throw new ErrorWithCode(\n formatString(ErrorMessage.NodejsRuntimeNotSupported, \"TeamsUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Popup login page to get user's access token with specific scopes.\n * @remarks\n * Can only be used within Teams.\n * @beta\n */\n public async login(scopes: string | string[]): Promise<void> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.NodejsRuntimeNotSupported, \"TeamsUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get access token from credential.\n * @remarks\n * Can only be used within Teams.\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.NodejsRuntimeNotSupported, \"TeamsUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get basic user info from SSO token\n * @remarks\n * Can only be used within Teams.\n * @beta\n */\n public getUserInfo(): Promise<UserInfo> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.NodejsRuntimeNotSupported, \"TeamsUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n"]}
@@ -1,14 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export { ErrorWithCode, ErrorCode } from "./core/errors";
4
- export { M365TenantCredential } from "./credential/m365TenantCredential";
5
- export { OnBehalfOfUserCredential } from "./credential/onBehalfOfUserCredential";
6
- export { TeamsUserCredential } from "./credential/teamsUserCredential";
7
- export { MsGraphAuthProvider } from "./core/msGraphAuthProvider";
8
- export { TeamsBotSsoPrompt } from "./bot/teamsBotSsoPrompt";
9
- export { getAuthenticationConfiguration, getResourceConfiguration, loadConfiguration, } from "./core/configurationProvider";
10
- export { ResourceType, } from "./models/configuration";
11
- export { createMicrosoftGraphClient } from "./core/msGraphClientProvider";
12
- export { DefaultTediousConnectionConfiguration } from "./core/defaultTediousConnectionConfiguration";
13
- export { LogLevel, setLogLevel, getLogLevel, setLogger, setLogFunction, } from "./util/logger";
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EAAE,iBAAiB,EAA6B,MAAM,yBAAyB,CAAC;AAEvF,OAAO,EACL,8BAA8B,EAC9B,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAIL,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAErG,OAAO,EAEL,QAAQ,EAER,WAAW,EACX,WAAW,EACX,SAAS,EACT,cAAc,GACf,MAAM,eAAe,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { ErrorWithCode, ErrorCode } from \"./core/errors\";\nexport { M365TenantCredential } from \"./credential/m365TenantCredential\";\nexport { OnBehalfOfUserCredential } from \"./credential/onBehalfOfUserCredential\";\nexport { TeamsUserCredential } from \"./credential/teamsUserCredential\";\nexport { MsGraphAuthProvider } from \"./core/msGraphAuthProvider\";\nexport { UserInfo } from \"./models/userinfo\";\nexport { TeamsBotSsoPrompt, TeamsBotSsoPromptSettings } from \"./bot/teamsBotSsoPrompt\";\nexport { TeamsBotSsoPromptTokenResponse } from \"./bot/teamsBotSsoPromptTokenResponse\";\nexport {\n getAuthenticationConfiguration,\n getResourceConfiguration,\n loadConfiguration,\n} from \"./core/configurationProvider\";\nexport {\n Configuration,\n AuthenticationConfiguration,\n ResourceConfiguration,\n ResourceType,\n} from \"./models/configuration\";\nexport { createMicrosoftGraphClient } from \"./core/msGraphClientProvider\";\nexport { DefaultTediousConnectionConfiguration } from \"./core/defaultTediousConnectionConfiguration\";\nexport { TokenCredential, GetTokenOptions } from \"@azure/identity\";\nexport {\n Logger,\n LogLevel,\n LogFunction,\n setLogLevel,\n getLogLevel,\n setLogger,\n setLogFunction,\n} from \"./util/logger\";\n"]}
@@ -1,4 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export {};
4
- //# sourceMappingURL=accessTokenResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"accessTokenResult.js","sourceRoot":"","sources":["../../../src/models/accessTokenResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * @internal\n */\nexport interface AccessTokenResult {\n scope: string;\n expires_on: number;\n access_token: string;\n}\n"]}
@@ -1,4 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export {};
4
- //# sourceMappingURL=authCodeResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authCodeResult.js","sourceRoot":"","sources":["../../../src/models/authCodeResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * @internal\n */\nexport interface AuthCodeResult {\n code: string;\n codeVerifier: string;\n redirectUri: string;\n}\n"]}