From 51b40dc184010a5b541e0ac1ec50858d16335f36 Mon Sep 17 00:00:00 2001 From: Alex Acebo Date: Thu, 18 Jan 2024 11:49:49 -0800 Subject: [PATCH] update teamssso message ext --- .../AdapterWithErrorHandler.cs | 11 +++++------ .../Controllers/BotController.cs | 6 +++--- .../MessageExtensionAuth.csproj | 2 +- .../06.auth.teamsSSO.messageExtension/Program.cs | 10 +++++----- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/dotnet/samples/06.auth.teamsSSO.messageExtension/AdapterWithErrorHandler.cs b/dotnet/samples/06.auth.teamsSSO.messageExtension/AdapterWithErrorHandler.cs index 984f40bf78..e3e4fa08d8 100644 --- a/dotnet/samples/06.auth.teamsSSO.messageExtension/AdapterWithErrorHandler.cs +++ b/dotnet/samples/06.auth.teamsSSO.messageExtension/AdapterWithErrorHandler.cs @@ -1,13 +1,12 @@ -using Microsoft.Bot.Builder.Integration.AspNet.Core; -using Microsoft.Bot.Builder.TraceExtensions; -using Microsoft.Bot.Connector.Authentication; +using Microsoft.Bot.Builder.TraceExtensions; +using Microsoft.Teams.AI; namespace MessageExtensionAuth { - public class AdapterWithErrorHandler : CloudAdapter + public class AdapterWithErrorHandler : TeamsAdapter { - public AdapterWithErrorHandler(BotFrameworkAuthentication auth, ILogger logger) - : base(auth, logger) + public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger) + : base(configuration, null, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/dotnet/samples/06.auth.teamsSSO.messageExtension/Controllers/BotController.cs b/dotnet/samples/06.auth.teamsSSO.messageExtension/Controllers/BotController.cs index 62eeb1e48a..b0da67652d 100644 --- a/dotnet/samples/06.auth.teamsSSO.messageExtension/Controllers/BotController.cs +++ b/dotnet/samples/06.auth.teamsSSO.messageExtension/Controllers/BotController.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Bot.Builder; -using Microsoft.Bot.Builder.Integration.AspNet.Core; +using Microsoft.Teams.AI; namespace MessageExtensionAuth.Controllers { @@ -8,10 +8,10 @@ namespace MessageExtensionAuth.Controllers [ApiController] public class BotController : ControllerBase { - private readonly CloudAdapter _adapter; + private readonly TeamsAdapter _adapter; private readonly IBot _bot; - public BotController(CloudAdapter adapter, IBot bot) + public BotController(TeamsAdapter adapter, IBot bot) { _adapter = adapter; _bot = bot; diff --git a/dotnet/samples/06.auth.teamsSSO.messageExtension/MessageExtensionAuth.csproj b/dotnet/samples/06.auth.teamsSSO.messageExtension/MessageExtensionAuth.csproj index 827569aaef..d007239519 100644 --- a/dotnet/samples/06.auth.teamsSSO.messageExtension/MessageExtensionAuth.csproj +++ b/dotnet/samples/06.auth.teamsSSO.messageExtension/MessageExtensionAuth.csproj @@ -16,7 +16,7 @@ - + diff --git a/dotnet/samples/06.auth.teamsSSO.messageExtension/Program.cs b/dotnet/samples/06.auth.teamsSSO.messageExtension/Program.cs index 3cd7774b4b..33d9d9affa 100644 --- a/dotnet/samples/06.auth.teamsSSO.messageExtension/Program.cs +++ b/dotnet/samples/06.auth.teamsSSO.messageExtension/Program.cs @@ -32,16 +32,16 @@ // Create the Cloud Adapter with error handling enabled. // Note: some classes expect a BotAdapter and some expect a BotFrameworkHttpAdapter, so // register the same adapter instance for all types. -builder.Services.AddSingleton(); -builder.Services.AddSingleton(sp => sp.GetService()!); -builder.Services.AddSingleton(sp => sp.GetService()!); +builder.Services.AddSingleton(); +builder.Services.AddSingleton(sp => sp.GetService()!); +builder.Services.AddSingleton(sp => sp.GetService()!); // Create singleton instances for bot application builder.Services.AddSingleton(); builder.Services.AddSingleton(); -builder.Services.AddSingleton(sp => +builder.Services.AddSingleton(sp => { IConfidentialClientApplication app = ConfidentialClientApplicationBuilder.Create(config.AAD_APP_CLIENT_ID) .WithClientSecret(config.AAD_APP_CLIENT_SECRET) @@ -56,7 +56,7 @@ builder.Services.AddTransient(sp => { IStorage storage = sp.GetService()!; - BotAdapter adapter = sp.GetService()!; + TeamsAdapter adapter = sp.GetService()!; IConfidentialClientApplication msal = sp.GetService(); string signInLink = $"https://{config.BOT_DOMAIN}/auth-start.html";