@microsoft/teamsfx-core 3.0.5-alpha.eb1380cea.0 → 3.0.5-alpha.fa365893d.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.
- package/build/common/constants.d.ts +1 -0
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/constants.js +2 -1
- package/build/common/constants.js.map +1 -1
- package/build/common/stringUtils.d.ts.map +1 -1
- package/build/common/stringUtils.js +2 -1
- package/build/common/stringUtils.js.map +1 -1
- package/build/common/templates-config.json +1 -1
- package/build/component/coordinator/index.d.ts +0 -1
- package/build/component/coordinator/index.d.ts.map +1 -1
- package/build/component/coordinator/index.js +53 -56
- package/build/component/coordinator/index.js.map +1 -1
- package/build/component/deps-checker/internal/funcToolChecker.js +1 -1
- package/build/component/deps-checker/internal/funcToolChecker.js.map +1 -1
- package/build/component/driver/share/utils.d.ts +5 -1
- package/build/component/driver/share/utils.d.ts.map +1 -1
- package/build/component/driver/share/utils.js +14 -15
- package/build/component/driver/share/utils.js.map +1 -1
- package/build/component/driver/teamsApp/createAppPackage.d.ts.map +1 -1
- package/build/component/driver/teamsApp/createAppPackage.js +5 -5
- package/build/component/driver/teamsApp/createAppPackage.js.map +1 -1
- package/build/component/driver/teamsApp/validate.d.ts.map +1 -1
- package/build/component/driver/teamsApp/validate.js +3 -1
- package/build/component/driver/teamsApp/validate.js.map +1 -1
- package/build/component/generator/spfx/spfxGenerator.d.ts +1 -1
- package/build/component/generator/spfx/spfxGenerator.d.ts.map +1 -1
- package/build/component/generator/spfx/spfxGenerator.js +12 -9
- package/build/component/generator/spfx/spfxGenerator.js.map +1 -1
- package/build/component/generator/spfx/utils/constants.d.ts +2 -0
- package/build/component/generator/spfx/utils/constants.d.ts.map +1 -1
- package/build/component/generator/spfx/utils/constants.js +2 -0
- package/build/component/generator/spfx/utils/constants.js.map +1 -1
- package/build/component/generator/utils.js +1 -1
- package/build/component/generator/utils.js.map +1 -1
- package/build/component/m365/interface.d.ts +6 -5
- package/build/component/m365/interface.d.ts.map +1 -1
- package/build/component/m365/interface.js +6 -5
- package/build/component/m365/interface.js.map +1 -1
- package/build/component/m365/packageService.d.ts +7 -2
- package/build/component/m365/packageService.d.ts.map +1 -1
- package/build/component/m365/packageService.js +130 -7
- package/build/component/m365/packageService.js.map +1 -1
- package/build/core/FxCore.d.ts +0 -3
- package/build/core/FxCore.d.ts.map +1 -1
- package/build/core/FxCore.js +40 -40
- package/build/core/FxCore.js.map +1 -1
- package/build/core/collaborator.d.ts.map +1 -1
- package/build/core/collaborator.js +26 -0
- package/build/core/collaborator.js.map +1 -1
- package/build/core/middleware/utils/debug/taskMigrator.js +1 -1
- package/build/core/share.d.ts +9 -0
- package/build/core/share.d.ts.map +1 -0
- package/build/core/share.js +104 -0
- package/build/core/share.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/question/constants.d.ts +1 -0
- package/build/question/constants.d.ts.map +1 -1
- package/build/question/constants.js +2 -1
- package/build/question/constants.js.map +1 -1
- package/build/question/generator.d.ts.map +1 -1
- package/build/question/generator.js.map +1 -1
- package/build/question/index.d.ts.map +1 -1
- package/build/question/index.js +3 -2
- package/build/question/index.js.map +1 -1
- package/build/question/inputs/ShareInputs.d.ts +6 -4
- package/build/question/inputs/ShareInputs.d.ts.map +1 -1
- package/build/question/inputs/index.d.ts +12 -12
- package/build/question/inputs/index.d.ts.map +1 -1
- package/build/question/inputs/index.js +12 -12
- package/build/question/inputs/index.js.map +1 -1
- package/build/question/options/ShareOptions.d.ts.map +1 -1
- package/build/question/options/ShareOptions.js +12 -5
- package/build/question/options/ShareOptions.js.map +1 -1
- package/build/question/other.d.ts +1 -4
- package/build/question/other.d.ts.map +1 -1
- package/build/question/other.js +23 -135
- package/build/question/other.js.map +1 -1
- package/build/question/questionNames.d.ts +2 -4
- package/build/question/questionNames.d.ts.map +1 -1
- package/build/question/questionNames.js +2 -4
- package/build/question/questionNames.js.map +1 -1
- package/build/question/share.d.ts +24 -0
- package/build/question/share.d.ts.map +1 -0
- package/build/question/share.js +177 -0
- package/build/question/share.js.map +1 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/resource/package.nls.json +22 -13
- package/templates/fallback/common.zip +0 -0
- package/templates/fallback/csharp.zip +0 -0
- package/templates/fallback/js.zip +0 -0
- package/templates/fallback/python.zip +0 -0
- package/templates/fallback/ts.zip +0 -0
- package/templates/plugins/resource/aad/auth/V3/Bot/SSO/BotAuthenticationOptions.cs +44 -0
- package/templates/plugins/resource/aad/auth/V3/Bot/SSO/IIdentityClientAdapter.cs +21 -0
- package/templates/plugins/resource/aad/auth/V3/Bot/SSO/ITeamsInfo.cs +24 -0
- package/templates/plugins/resource/aad/auth/V3/Bot/SSO/IdentityClientAdapter.cs +30 -0
- package/templates/plugins/resource/aad/auth/V3/Bot/SSO/SsoDialog.cs +12 -9
- package/templates/plugins/resource/aad/auth/V3/Bot/SSO/SsoOperations.cs +2 -2
- package/templates/plugins/resource/aad/auth/V3/Bot/SSO/TeamsBotSsoPrompt.cs +424 -0
- package/templates/plugins/resource/aad/auth/V3/Bot/SSO/TeamsBotSsoPromptTokenResponse.cs +21 -0
- package/templates/plugins/resource/aad/auth/V3/Bot/SSO/TeamsInfoWrapper.cs +20 -0
- package/templates/plugins/resource/aad/auth/V3/Bot/SSO/TeamsSsoBot.cs +6 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/teamsfx-core",
|
|
3
|
-
"version": "3.0.5-alpha.
|
|
3
|
+
"version": "3.0.5-alpha.fa365893d.0",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"types": "build/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
"@microsoft/dev-tunnels-contracts": "1.1.9",
|
|
108
108
|
"@microsoft/dev-tunnels-management": "1.1.9",
|
|
109
109
|
"@microsoft/kiota": "1.26.1",
|
|
110
|
-
"@microsoft/m365-spec-parser": "^0.2.9-alpha.
|
|
111
|
-
"@microsoft/teamsfx-api": "0.23.9-alpha.
|
|
110
|
+
"@microsoft/m365-spec-parser": "^0.2.9-alpha.fa365893d.0",
|
|
111
|
+
"@microsoft/teamsfx-api": "0.23.9-alpha.fa365893d.0",
|
|
112
112
|
"adm-zip": "^0.5.10",
|
|
113
113
|
"ajv": "^8.5.0",
|
|
114
114
|
"axios": "^1.8.3",
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
"resource/**/*",
|
|
232
232
|
"templates/**/*"
|
|
233
233
|
],
|
|
234
|
-
"gitHead": "
|
|
234
|
+
"gitHead": "4cfbfd82137232f56f82a385309e1a1541b2510a",
|
|
235
235
|
"publishConfig": {
|
|
236
236
|
"access": "public"
|
|
237
237
|
},
|
|
@@ -245,13 +245,13 @@
|
|
|
245
245
|
"error.apime.noExtraAPICanBeAdded": "Unable to add API because only GET and POST methods are supported, with a maximum of 5 required parameters and no authentication. Also, methods defined in the manifest are not listed.",
|
|
246
246
|
"error.copilot.noExtraAPICanBeAdded": "Unable to add API because no authentication is supported. Also, methods defined in the current OpenAPI description document are not listed.",
|
|
247
247
|
"error.m365.NotExtendedToM365Error": "Unable to extend the app to Microsoft 365. Use 'teamsApp/extendToM365' action to extend the app to Microsoft 365.",
|
|
248
|
-
"error.share.yamlConfigNotFound": "Unable to find the \"
|
|
248
|
+
"error.share.yamlConfigNotFound": "Unable to find the \"deploy\" config in the m365agents.yml",
|
|
249
249
|
"error.share.shareActionConfigNotFound": "Unable to find the \"%s\" action config in the m365agents.yml",
|
|
250
250
|
"error.share.appPackageConfigNotFound": "Unable to find the appPackagePath config in the m365agents.yml",
|
|
251
251
|
"error.share.manifestFileNotFound": "Unable to find the manifest file in the app package",
|
|
252
252
|
"error.share.manifestIdNotFound": "Unable to find the manifest ID in the app package",
|
|
253
253
|
"error.share.sharedConfigNotFound": "Unable to find the \"titleId\" or \"appId\" config in the m365agents.yml",
|
|
254
|
-
"error.share.sharedIdNotFound": "Unable to get
|
|
254
|
+
"error.share.sharedIdNotFound": "Unable to get title id or app id in the .env file. Shared title id: %s, shared app id: %s. You need to deploy the agent before sharing.",
|
|
255
255
|
"error.share.appPackageNotFound": "Unable to find the zip package in path: %s. You need to zip the package first.",
|
|
256
256
|
"core.QuestionAppName.validation.pattern": "App name needs to begin with letters, include minimum two letters or digits, and exclude certain special characters.",
|
|
257
257
|
"core.QuestionAppName.validation.maxlength": "App name is longer than the 30 characters.",
|
|
@@ -522,7 +522,6 @@
|
|
|
522
522
|
"core.addKnowledge.success.vsc": "Capability source added to the project successfully.",
|
|
523
523
|
"core.addKnowledge.success": "Capability source added to the project successfully. View agent manifest in \"%s\".",
|
|
524
524
|
"core.addKnowledge.success.viewAgentManifest": "View agent manifest",
|
|
525
|
-
"core.addUserQuestion.validation": "Invalid email address",
|
|
526
525
|
"core.scaffold.warning.summary": "We have detected following issues:\n%s",
|
|
527
526
|
"core.addPlugin.warning.manifestVariables": "Environment variables \"%s\" found in manifest of the added plugin. Ensure the values are set in .env file or system environment variables.",
|
|
528
527
|
"core.addPlugin.warning.apiSpecVariables": "Environment variables \"%s\" found in API specification of the added plugin. Ensure the values are set in .env file or system environment variables.",
|
|
@@ -545,6 +544,7 @@
|
|
|
545
544
|
"core.getUserEmailQuestion.title": "Add owner to Teams/Microsoft Entra app for the account under the same Microsoft 365 tenant (email)",
|
|
546
545
|
"core.getUserEmailQuestion.validation1": "Enter email address",
|
|
547
546
|
"core.getUserEmailQuestion.validation2": "Change [UserName] to the real user name",
|
|
547
|
+
"core.getUserEmailQuestion.validation3": "Email address is invalid",
|
|
548
548
|
"core.collaboration.error.failedToLoadDotEnvFile": "Unable to load your .env File. Reason: %s",
|
|
549
549
|
"core.selectAadAppManifestQuestion.title": "Select Microsoft Entra manifest.json file",
|
|
550
550
|
"core.selectTeamsAppManifestQuestion.title": "Select Teams manifest.json File",
|
|
@@ -639,8 +639,11 @@
|
|
|
639
639
|
"core.common.ErrorFetchApiSpec": "Your OpenAPI description document should be accessible without authentication, otherwise download and start from a local copy.",
|
|
640
640
|
"core.common.SendingApiRequest": "Sending API request: %s. Request body: %s",
|
|
641
641
|
"core.common.ReceiveApiResponse": "Received API response: %s.",
|
|
642
|
-
"core.common.
|
|
643
|
-
"core.common.
|
|
642
|
+
"core.common.shareWithTenant.success": "Agent successfully shared with tenant.",
|
|
643
|
+
"core.common.shareWithUser.success": "Agent successfully shared with users: %s.",
|
|
644
|
+
"core.common.shareWithOwner.success": "Agent successfully shared with owners: %s.",
|
|
645
|
+
"core.common.removeOwnership.success": "Shared agent ownership removed from the users: %s.",
|
|
646
|
+
"core.common.removeShareAccess.success": "Shared access successfully removed from users: %s.",
|
|
644
647
|
"core.envFunc.unsupportedFile.errorLog": "\"%s\" is an invalid file. Supported format: %s.",
|
|
645
648
|
"core.envFunc.unsupportedFile.errorMessage": "Invalid file. %s",
|
|
646
649
|
"core.envFunc.unsupportedFunction.errorLog": "\"%s\" is an invalid function. Supported function: \"%s\".",
|
|
@@ -664,7 +667,7 @@
|
|
|
664
667
|
"core.summary.lifecycleFailed": "%s Lifecycle stage %s failed.",
|
|
665
668
|
"core.summary.actionNotExecuted": "%s was not executed.",
|
|
666
669
|
"core.summary.actionFailed": "%s failed.",
|
|
667
|
-
"core.summary.actionSucceeded": "%s
|
|
670
|
+
"core.summary.actionSucceeded": "%s executed successfully.",
|
|
668
671
|
"core.summary.createdEnvFile": "Environment file was created at",
|
|
669
672
|
"core.copilot.addAPI.success": "%s have(has) been successfully added to %s",
|
|
670
673
|
"core.copilot.addAPI.InjectAPIKeyActionFailed": "Inject API key action to teamsapp.yaml file unsuccessful, make sure the file contains teamsApp/create action in provision section.",
|
|
@@ -696,11 +699,18 @@
|
|
|
696
699
|
"core.uninstallQuestion.tdpOption": "App registration",
|
|
697
700
|
"core.uninstallQuestion.botOption": "Bot framework registration",
|
|
698
701
|
"core.uninstallQuestion.projectPath": "Project path",
|
|
699
|
-
"core.shareOptionQuestion.share": "Share the app",
|
|
700
|
-
"core.shareOptionQuestion.shareToUser": "Share with user(s)",
|
|
701
|
-
"core.shareOptionQuestion.placeholder": "Select an option",
|
|
702
|
-
"core.shareToUser.title": "Enter user emails (separated by commas)",
|
|
703
702
|
"core.share.removeAccess.operator": "Cannot remove permission of the operator. Email: %s.",
|
|
703
|
+
"core.shareOperationQuestion.option.removeShareAccessFromUsers": "Remove access for selected user(s)",
|
|
704
|
+
"core.shareOperationQuestion.option.shareWithUsers": "Share access with selected user(s)",
|
|
705
|
+
"core.shareOptionQuestion.option.shareWithOwners": "Share agent ownership with selected user(s)",
|
|
706
|
+
"core.shareOptionQuestion.placeholder": "Select how to share the agent",
|
|
707
|
+
"core.shareOptionQuestion.title": "Share the agent",
|
|
708
|
+
"core.shareOptionQuestion.unshare.emails.title": "Email addresses of users for agent access removal",
|
|
709
|
+
"core.shareScopeQuestion.emails.title": "Email addresses of users for agent sharing",
|
|
710
|
+
"core.shareScopeQuestion.option.shareWithTenant": "Share the agent with all tenant users",
|
|
711
|
+
"core.shareScopeQuestion.option.shareWithUsers": "Share the agent with selected user(s)",
|
|
712
|
+
"core.shareScopeQuestion.placeholder": "Select a sharing scope",
|
|
713
|
+
"core.shareScopeQuestion.title": "Share the agent with users",
|
|
704
714
|
"core.syncManifest.projectPath": "Project path",
|
|
705
715
|
"core.syncManifest.env": "Target Microsoft 365 Agents Toolkit Environment",
|
|
706
716
|
"core.syncManifest.teamsAppId": "App ID (optional)",
|
|
@@ -737,7 +747,6 @@
|
|
|
737
747
|
"error.aad.manifest.UnknownResourceAccessId": "Unknown resourceAccess id: %s, try to use permission id instead of resourceAccess id.",
|
|
738
748
|
"core.addSsoFiles.emptyProjectPath": "Project path is empty",
|
|
739
749
|
"core.addSsoFiles.FailedToCreateAuthFiles": "Unable to create files for add sso. Detail error: %s.",
|
|
740
|
-
"core.getUserEmailQuestion.validation3": "Email address is invalid",
|
|
741
750
|
"plugins.bot.ErrorSuggestions": "Suggestions: %s",
|
|
742
751
|
"plugins.bot.InvalidValue": "%s is invalid with value: %s",
|
|
743
752
|
"plugins.bot.SomethingIsMissing": "%s is not available.",
|
|
@@ -933,9 +942,9 @@
|
|
|
933
942
|
"driver.botFramework.summary.update": "The bot registration has been updated successfully (%s).",
|
|
934
943
|
"driver.botFramework.progressBar.createOrUpdateBot": "Creating or updating bot registration.",
|
|
935
944
|
"driver.botFramework.error.InvalidBotId": "Bot ID %s is invalid. It must be a GUID.",
|
|
936
|
-
"driver.devChannel.description": "Create a
|
|
945
|
+
"driver.devChannel.description": "Create a sandbox in Teams with a channel for development and testing",
|
|
937
946
|
"driver.devChannel.progress.message": "Creating Team and channel...",
|
|
938
|
-
"driver.devChannel.success": "Team %s with default channel %s created. Channel ID: %s
|
|
947
|
+
"driver.devChannel.success": "Team %s with default channel %s created. Channel ID: %s Team ID: %s",
|
|
939
948
|
"driver.devChannel.summary": "Team %s with default channel %s created.",
|
|
940
949
|
"driver.devChannel.status": "Team and channel creation status: %s",
|
|
941
950
|
"driver.devChannel.summary.exists": "Environment variable %s and %s already exist, skipping new sandboxed Team creation step.",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
using System.ComponentModel.DataAnnotations;
|
|
5
|
+
|
|
6
|
+
namespace {{YOUR_NAMESPACE}}.Configuration;
|
|
7
|
+
|
|
8
|
+
/// <summary>
|
|
9
|
+
/// Bot related authentication configuration.
|
|
10
|
+
/// </summary>
|
|
11
|
+
public class BotAuthenticationOptions
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// The client (application) ID of an App Registration in the tenant.
|
|
15
|
+
/// </summary>
|
|
16
|
+
[Required(ErrorMessage = "Client id is required")]
|
|
17
|
+
[RegularExpression(@"^[0-9A-Fa-f\-]{36}$")]
|
|
18
|
+
public string ClientId { get; set; }
|
|
19
|
+
|
|
20
|
+
/// <summary>
|
|
21
|
+
/// The client (application) Secret of an App Registration in the tenant.
|
|
22
|
+
/// </summary>
|
|
23
|
+
[Required(ErrorMessage = "Client secret is required")]
|
|
24
|
+
public string ClientSecret { get; set; }
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
/// Authority URL that is used in OAuth On-behalf-of flow.
|
|
28
|
+
/// </summary>
|
|
29
|
+
[Required(ErrorMessage = "OAuth authority is required")]
|
|
30
|
+
[RegularExpression(@"^http(s)?://[-a-zA-Z0-9@:%._\+~#=/]{1,100}$")]
|
|
31
|
+
public string OAuthAuthority { get; set; }
|
|
32
|
+
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Application ID URI.
|
|
35
|
+
/// </summary>
|
|
36
|
+
[Required(ErrorMessage = "Application id uri is required")]
|
|
37
|
+
public string ApplicationIdUri { get; set; }
|
|
38
|
+
|
|
39
|
+
/// <summary>
|
|
40
|
+
/// Login authentication start page endpoint.
|
|
41
|
+
/// </summary>
|
|
42
|
+
[Required(ErrorMessage = "Login authentication start page endpoint is required")]
|
|
43
|
+
public string InitiateLoginEndpoint { get; set; }
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
using Microsoft.Identity.Client;
|
|
5
|
+
|
|
6
|
+
namespace {{YOUR_NAMESPACE}}.SSO
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
/// Adapter of IConfidentialClientApplication On-behalf-of flow.
|
|
10
|
+
/// </summary>
|
|
11
|
+
public interface IIdentityClientAdapter
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// Use On-behalf-of flow to exchange access token.
|
|
15
|
+
/// </summary>
|
|
16
|
+
/// <param name="ssoToken">token from Teams client</param>
|
|
17
|
+
/// <param name="scopes">required scopes</param>
|
|
18
|
+
/// <returns></returns>
|
|
19
|
+
Task<AuthenticationResult> GetAccessToken(string ssoToken, IEnumerable<string> scopes);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
using Microsoft.Agents.Builder;
|
|
5
|
+
using Microsoft.Agents.Extensions.Teams.Models;
|
|
6
|
+
|
|
7
|
+
namespace {{YOUR_NAMESPACE}}.SSO
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
/// provides utility methods for interactions that occur within Microsoft Teams.
|
|
11
|
+
/// </summary>
|
|
12
|
+
public interface ITeamsInfo
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
/// Gets the account of a single conversation member.
|
|
16
|
+
/// This works in one-on-one, group, and teams scoped conversations.
|
|
17
|
+
/// </summary>
|
|
18
|
+
/// <param name="context"> Turn context. </param>
|
|
19
|
+
/// <param name="userId"> ID of the user in question. </param>
|
|
20
|
+
/// <param name="cancellationToken"> cancellation token. </param>
|
|
21
|
+
/// <returns>Team Account Details.</returns>
|
|
22
|
+
Task<TeamsChannelAccount> GetTeamsMemberAsync(ITurnContext context, string userId, CancellationToken cancellationToken = default);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
using Microsoft.Identity.Client;
|
|
5
|
+
|
|
6
|
+
namespace {{YOUR_NAMESPACE}}.SSO
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
/// Helper class used to simplify unit test.
|
|
10
|
+
/// https://stackoverflow.com/questions/65334284/how-to-mock-moq-iconfidentialclientapplication-which-has-sealed-setup-abstract
|
|
11
|
+
/// </summary>
|
|
12
|
+
internal class IdentityClientAdapter : IIdentityClientAdapter
|
|
13
|
+
{
|
|
14
|
+
private readonly IConfidentialClientApplication _confidentialClientApplication;
|
|
15
|
+
|
|
16
|
+
public IdentityClientAdapter(IConfidentialClientApplication confidentialClientApplication)
|
|
17
|
+
{
|
|
18
|
+
_confidentialClientApplication = confidentialClientApplication;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public async Task<AuthenticationResult> GetAccessToken(string ssoToken, IEnumerable<string> scopes)
|
|
22
|
+
{
|
|
23
|
+
var userAssertion = new UserAssertion(ssoToken);
|
|
24
|
+
return await _confidentialClientApplication
|
|
25
|
+
.AcquireTokenOnBehalfOf(scopes, userAssertion)
|
|
26
|
+
.ExecuteAsync()
|
|
27
|
+
.ConfigureAwait(false);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
using
|
|
2
|
-
using
|
|
3
|
-
using Microsoft.
|
|
1
|
+
using bowsong080401botsso.Configuration;
|
|
2
|
+
using Json.More;
|
|
3
|
+
using Microsoft.Agents.Builder;
|
|
4
|
+
using Microsoft.Agents.Builder.Dialogs;
|
|
5
|
+
using Microsoft.Agents.Builder.State;
|
|
6
|
+
using Microsoft.Agents.Core.Models;
|
|
7
|
+
using Microsoft.Agents.Storage;
|
|
4
8
|
using Microsoft.Extensions.Options;
|
|
5
|
-
using Microsoft.TeamsFx.Bot;
|
|
6
|
-
using Microsoft.TeamsFx.Configuration;
|
|
7
9
|
|
|
8
10
|
namespace {{YOUR_NAMESPACE}}.SSO;
|
|
9
11
|
|
|
@@ -173,9 +175,10 @@ public class SsoDialog : ComponentDialog
|
|
|
173
175
|
|
|
174
176
|
private async Task<bool> ShouldDedup(ITurnContext context)
|
|
175
177
|
{
|
|
178
|
+
var tokenResponseObject = context.Activity.Value.ToJsonDocument();
|
|
176
179
|
var storeItem = new StoreItem()
|
|
177
180
|
{
|
|
178
|
-
eTag =
|
|
181
|
+
eTag = tokenResponseObject.RootElement.GetProperty("id").ToString(),
|
|
179
182
|
};
|
|
180
183
|
var key = GetStorageKey(context);
|
|
181
184
|
var storeItems = new Dictionary<string, object>()
|
|
@@ -209,13 +212,13 @@ public class SsoDialog : ComponentDialog
|
|
|
209
212
|
throw new Exception("TokenExchangeState can only be used with Invokes of signin/tokenExchange.");
|
|
210
213
|
}
|
|
211
214
|
|
|
212
|
-
var value = activity.Value;
|
|
213
|
-
if (value == null || (
|
|
215
|
+
var value = activity.Value.ToJsonDocument();
|
|
216
|
+
if (value == null || value.RootElement.GetProperty("id").ToString() == null)
|
|
214
217
|
{
|
|
215
218
|
throw new Exception("Invalid signin/tokenExchange. Missing activity.value.id.");
|
|
216
219
|
}
|
|
217
220
|
|
|
218
|
-
return $"{channelId}/{conversationId}/{(
|
|
221
|
+
return $"{channelId}/{conversationId}/{value.RootElement.GetProperty("id").ToString()}";
|
|
219
222
|
}
|
|
220
223
|
|
|
221
224
|
private string MatchCommands(string text)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
using
|
|
1
|
+
using bowsong080401botsso.Configuration;
|
|
2
|
+
using Microsoft.Agents.Builder;
|
|
2
3
|
using Microsoft.Graph;
|
|
3
4
|
using Microsoft.Kiota.Abstractions.Authentication;
|
|
4
|
-
using Microsoft.TeamsFx.Configuration;
|
|
5
5
|
|
|
6
6
|
namespace {{YOUR_NAMESPACE}}.SSO;
|
|
7
7
|
|