diff --git a/skills/src/csharp/automotiveskill/automotiveskill/AutomotiveSkill.csproj b/skills/src/csharp/automotiveskill/automotiveskill/AutomotiveSkill.csproj index 443a401cf1..d8b9300be5 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/AutomotiveSkill.csproj +++ b/skills/src/csharp/automotiveskill/automotiveskill/AutomotiveSkill.csproj @@ -24,7 +24,8 @@ - + + diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Controllers/BotController.cs b/skills/src/csharp/automotiveskill/automotiveskill/Controllers/BotController.cs index 4f563b8f5e..a173a2bf6a 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Controllers/BotController.cs +++ b/skills/src/csharp/automotiveskill/automotiveskill/Controllers/BotController.cs @@ -1,5 +1,6 @@ -using System; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Bot.Builder; +using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions; @@ -8,9 +9,14 @@ namespace AutomotiveSkill.Controllers [ApiController] public class BotController : SkillController { - public BotController(IServiceProvider serviceProvider, BotSettingsBase botSettings) - : base(serviceProvider, botSettings) - { - } - } + public BotController( + IBotFrameworkHttpAdapter botFrameworkHttpAdapter, + SkillHttpAdapter skillHttpAdapter, + SkillWebSocketAdapter skillWebSocketAdapter, + IBot bot, + BotSettingsBase botSettings) + : base(botFrameworkHttpAdapter, skillHttpAdapter, skillWebSocketAdapter, bot, botSettings) + { + } + } } \ No newline at end of file diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Startup.cs b/skills/src/csharp/automotiveskill/automotiveskill/Startup.cs index 468e769e5f..91c15df22a 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Startup.cs +++ b/skills/src/csharp/automotiveskill/automotiveskill/Startup.cs @@ -12,7 +12,6 @@ namespace AutomotiveSkill using AutomotiveSkill.Responses.VehicleSettings; using AutomotiveSkill.Services; using Microsoft.ApplicationInsights; - using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Bot.Builder; @@ -23,13 +22,11 @@ namespace AutomotiveSkill using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions; - using Microsoft.Bot.Builder.Solutions.Proactive; using Microsoft.Bot.Builder.Solutions.Responses; using Microsoft.Bot.Builder.Solutions.TaskExtensions; using Microsoft.Bot.Connector.Authentication; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; - using Microsoft.IdentityModel.Tokens; public class Startup { @@ -77,12 +74,10 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(new CosmosDbStorage(settings.CosmosDb)); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(sp => { var userState = sp.GetService(); var conversationState = sp.GetService(); - var proactiveState = sp.GetService(); return new BotStateSet(userState, conversationState); }); @@ -102,18 +97,6 @@ public void ConfigureServices(IServiceCollection services) new AutomotiveSkillSharedResponses(), new VehicleSettingsResponses())); - // Configure Skill authentication - services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(options => - { - options.Authority = "https://login.microsoftonline.com/microsoft.com"; - options.Audience = settings.MicrosoftAppId; - options.TokenValidationParameters = new TokenValidationParameters - { - ValidIssuer = "https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0", - }; - }); - // Configure adapters services.AddTransient(); services.AddTransient(); @@ -134,9 +117,9 @@ public void ConfigureServices(IServiceCollection services) public void Configure(IApplicationBuilder app, IHostingEnvironment env) { _isProduction = env.IsProduction(); - app.UseDefaultFiles() + app.UseBotApplicationInsights() + .UseDefaultFiles() .UseStaticFiles() - .UseAuthentication() .UseWebSockets() .UseMvc(); } diff --git a/skills/src/csharp/calendarskill/calendarskill/CalendarSkill.csproj b/skills/src/csharp/calendarskill/calendarskill/CalendarSkill.csproj index 300e4e3294..2ccd49b37e 100644 --- a/skills/src/csharp/calendarskill/calendarskill/CalendarSkill.csproj +++ b/skills/src/csharp/calendarskill/calendarskill/CalendarSkill.csproj @@ -97,7 +97,8 @@ - + + diff --git a/skills/src/csharp/calendarskill/calendarskill/Controllers/BotController.cs b/skills/src/csharp/calendarskill/calendarskill/Controllers/BotController.cs index 0e9bb6d18d..a5c637103a 100644 --- a/skills/src/csharp/calendarskill/calendarskill/Controllers/BotController.cs +++ b/skills/src/csharp/calendarskill/calendarskill/Controllers/BotController.cs @@ -1,16 +1,21 @@ -using System; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Bot.Builder; +using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions; -using Microsoft.Extensions.Configuration; namespace CalendarSkill.Controllers { [ApiController] public class BotController : SkillController { - public BotController(IServiceProvider serviceProvider, BotSettingsBase botSettings) - : base(serviceProvider, botSettings) + public BotController( + IBotFrameworkHttpAdapter botFrameworkHttpAdapter, + SkillHttpAdapter skillHttpAdapter, + SkillWebSocketAdapter skillWebSocketAdapter, + IBot bot, + BotSettingsBase botSettings) + : base(botFrameworkHttpAdapter, skillHttpAdapter, skillWebSocketAdapter, bot, botSettings) { } } diff --git a/skills/src/csharp/calendarskill/calendarskill/Dialogs/CalendarSkillDialog.cs b/skills/src/csharp/calendarskill/calendarskill/Dialogs/CalendarSkillDialog.cs index 44a4725429..a839f8624a 100644 --- a/skills/src/csharp/calendarskill/calendarskill/Dialogs/CalendarSkillDialog.cs +++ b/skills/src/csharp/calendarskill/calendarskill/Dialogs/CalendarSkillDialog.cs @@ -17,7 +17,6 @@ using Microsoft.Bot.Builder.Dialogs; using Microsoft.Bot.Builder.Dialogs.Choices; using Microsoft.Bot.Builder.Skills; -using Microsoft.Bot.Builder.Solutions; using Microsoft.Bot.Builder.Solutions.Authentication; using Microsoft.Bot.Builder.Solutions.Resources; using Microsoft.Bot.Builder.Solutions.Responses; @@ -54,7 +53,7 @@ public CalendarSkillDialog( throw new Exception("You must configure an authentication connection in your bot file before using this component."); } - AddDialog(new MultiProviderAuthDialog(ResponseManager, settings.OAuthConnections)); + AddDialog(new MultiProviderAuthDialog(settings.OAuthConnections)); AddDialog(new TextPrompt(Actions.Prompt)); AddDialog(new ConfirmPrompt(Actions.TakeFurtherAction, null, Culture.English) { Style = ListStyle.SuggestedAction }); AddDialog(new DateTimePrompt(Actions.DateTimePrompt, DateTimeValidator, Culture.English)); diff --git a/skills/src/csharp/calendarskill/calendarskill/Startup.cs b/skills/src/csharp/calendarskill/calendarskill/Startup.cs index aff45401be..9eb273a04e 100644 --- a/skills/src/csharp/calendarskill/calendarskill/Startup.cs +++ b/skills/src/csharp/calendarskill/calendarskill/Startup.cs @@ -16,7 +16,6 @@ using CalendarSkill.Responses.UpdateEvent; using CalendarSkill.Services; using Microsoft.ApplicationInsights; -using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Bot.Builder; @@ -33,7 +32,6 @@ using Microsoft.Bot.Connector.Authentication; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.IdentityModel.Tokens; namespace CalendarSkill { @@ -84,7 +82,7 @@ public void ConfigureServices(IServiceCollection services) var userState = sp.GetService(); var conversationState = sp.GetService(); var proactiveState = sp.GetService(); - return new BotStateSet(userState, conversationState); + return new BotStateSet(userState, conversationState, proactiveState); }); // Configure telemetry @@ -112,18 +110,6 @@ public void ConfigureServices(IServiceCollection services) new TimeRemainingResponses(), new UpdateEventResponses())); - // Configure Skill authentication - services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(options => - { - options.Authority = "https://login.microsoftonline.com/microsoft.com"; - options.Audience = settings.MicrosoftAppId; - options.TokenValidationParameters = new TokenValidationParameters - { - ValidIssuer = "https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0", - }; - }); - // Configure adapters services.AddTransient(); services.AddTransient(); @@ -147,7 +133,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) app.UseBotApplicationInsights() .UseDefaultFiles() .UseStaticFiles() - .UseAuthentication() .UseWebSockets() .UseMvc(); } diff --git a/skills/src/csharp/emailskill/emailskill/Controllers/BotController.cs b/skills/src/csharp/emailskill/emailskill/Controllers/BotController.cs index 1623555853..cce7181553 100644 --- a/skills/src/csharp/emailskill/emailskill/Controllers/BotController.cs +++ b/skills/src/csharp/emailskill/emailskill/Controllers/BotController.cs @@ -1,5 +1,6 @@ -using System; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Bot.Builder; +using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions; @@ -8,8 +9,13 @@ namespace EmailSkill.Controllers [ApiController] public class BotController : SkillController { - public BotController(IServiceProvider serviceProvider, BotSettingsBase botSettings) - : base(serviceProvider, botSettings) + public BotController( + IBotFrameworkHttpAdapter botFrameworkHttpAdapter, + SkillHttpAdapter skillHttpAdapter, + SkillWebSocketAdapter skillWebSocketAdapter, + IBot bot, + BotSettingsBase botSettings) + : base(botFrameworkHttpAdapter, skillHttpAdapter, skillWebSocketAdapter, bot, botSettings) { } } diff --git a/skills/src/csharp/emailskill/emailskill/Dialogs/EmailSkillDialogBase.cs b/skills/src/csharp/emailskill/emailskill/Dialogs/EmailSkillDialogBase.cs index 37cae5e3ed..ef0a67125d 100644 --- a/skills/src/csharp/emailskill/emailskill/Dialogs/EmailSkillDialogBase.cs +++ b/skills/src/csharp/emailskill/emailskill/Dialogs/EmailSkillDialogBase.cs @@ -53,7 +53,7 @@ public EmailSkillDialogBase( throw new Exception("You must configure an authentication connection in your bot file before using this component."); } - AddDialog(new MultiProviderAuthDialog(ResponseManager, settings.OAuthConnections)); + AddDialog(new MultiProviderAuthDialog(settings.OAuthConnections)); AddDialog(new TextPrompt(Actions.Prompt)); AddDialog(new ConfirmPrompt(Actions.TakeFurtherAction, null, Culture.English) { Style = ListStyle.SuggestedAction }); } diff --git a/skills/src/csharp/emailskill/emailskill/EmailSkill.csproj b/skills/src/csharp/emailskill/emailskill/EmailSkill.csproj index 72dd5ee8d9..130129254c 100644 --- a/skills/src/csharp/emailskill/emailskill/EmailSkill.csproj +++ b/skills/src/csharp/emailskill/emailskill/EmailSkill.csproj @@ -36,7 +36,8 @@ - + + diff --git a/skills/src/csharp/emailskill/emailskill/Startup.cs b/skills/src/csharp/emailskill/emailskill/Startup.cs index 8f31fb063a..ce3b30abd7 100644 --- a/skills/src/csharp/emailskill/emailskill/Startup.cs +++ b/skills/src/csharp/emailskill/emailskill/Startup.cs @@ -16,7 +16,6 @@ using EmailSkill.ServiceClients; using EmailSkill.Services; using Microsoft.ApplicationInsights; -using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Bot.Builder; @@ -27,13 +26,11 @@ using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions; -using Microsoft.Bot.Builder.Solutions.Proactive; using Microsoft.Bot.Builder.Solutions.Responses; using Microsoft.Bot.Builder.Solutions.TaskExtensions; using Microsoft.Bot.Connector.Authentication; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.IdentityModel.Tokens; namespace EmailSkill { @@ -78,12 +75,10 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(new CosmosDbStorage(settings.CosmosDb)); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(sp => { var userState = sp.GetService(); var conversationState = sp.GetService(); - var proactiveState = sp.GetService(); return new BotStateSet(userState, conversationState); }); @@ -111,18 +106,6 @@ public void ConfigureServices(IServiceCollection services) new EmailSharedResponses(), new ShowEmailResponses())); - // Configure Skill authentication - services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(options => - { - options.Authority = "https://login.microsoftonline.com/microsoft.com"; - options.Audience = settings.MicrosoftAppId; - options.TokenValidationParameters = new TokenValidationParameters - { - ValidIssuer = "https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0", - }; - }); - // Configure adapters services.AddTransient(); services.AddTransient(); @@ -146,7 +129,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) app.UseBotApplicationInsights() .UseDefaultFiles() .UseStaticFiles() - .UseAuthentication() .UseWebSockets() .UseMvc(); } diff --git a/skills/src/csharp/experimental/newsskill/Controllers/BotController.cs b/skills/src/csharp/experimental/newsskill/Controllers/BotController.cs index df7b85a1c7..d9adec8f25 100644 --- a/skills/src/csharp/experimental/newsskill/Controllers/BotController.cs +++ b/skills/src/csharp/experimental/newsskill/Controllers/BotController.cs @@ -1,5 +1,6 @@ -using System; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Bot.Builder; +using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions; @@ -8,8 +9,13 @@ namespace NewsSkill.Controllers [ApiController] public class BotController : SkillController { - public BotController(IServiceProvider serviceProvider, BotSettingsBase botSettings) - : base(serviceProvider, botSettings) + public BotController( + IBotFrameworkHttpAdapter botFrameworkHttpAdapter, + SkillHttpAdapter skillHttpAdapter, + SkillWebSocketAdapter skillWebSocketAdapter, + IBot bot, + BotSettingsBase botSettings) + : base(botFrameworkHttpAdapter, skillHttpAdapter, skillWebSocketAdapter, bot, botSettings) { } } diff --git a/skills/src/csharp/experimental/newsskill/NewsSkill.csproj b/skills/src/csharp/experimental/newsskill/NewsSkill.csproj index 3667095c86..bae4e7390c 100644 --- a/skills/src/csharp/experimental/newsskill/NewsSkill.csproj +++ b/skills/src/csharp/experimental/newsskill/NewsSkill.csproj @@ -15,7 +15,8 @@ - + + diff --git a/skills/src/csharp/experimental/newsskill/Startup.cs b/skills/src/csharp/experimental/newsskill/Startup.cs index d7c96bf9bf..544113bf7d 100644 --- a/skills/src/csharp/experimental/newsskill/Startup.cs +++ b/skills/src/csharp/experimental/newsskill/Startup.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Microsoft.ApplicationInsights; -using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; @@ -19,7 +18,6 @@ using Microsoft.Bot.Connector.Authentication; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.IdentityModel.Tokens; using NewsSkill.Adapters; using NewsSkill.Bots; using NewsSkill.Dialogs; @@ -73,12 +71,10 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(new CosmosDbStorage(settings.CosmosDb)); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(sp => { var userState = sp.GetService(); var conversationState = sp.GetService(); - var proactiveState = sp.GetService(); return new BotStateSet(userState, conversationState); }); @@ -94,22 +90,6 @@ public void ConfigureServices(IServiceCollection services) // Configure HttpContext required for path resolution services.AddSingleton(); - // Configure skill authentication - services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(options => - { - options.Authority = "https://login.microsoftonline.com/microsoft.com"; - options.Audience = settings.MicrosoftAppId; - options.TokenValidationParameters = new TokenValidationParameters - { - ValidIssuer = "https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0", - }; - }); - - // comment out for now to disable whitelist checking - // services.AddSingleton(); - // services.AddSingleton(); - // Configure adapters services.AddTransient(); services.AddTransient(); @@ -130,9 +110,9 @@ public void ConfigureServices(IServiceCollection services) public void Configure(IApplicationBuilder app, IHostingEnvironment env) { _isProduction = env.IsProduction(); - app.UseDefaultFiles() + app.UseBotApplicationInsights() + .UseDefaultFiles() .UseStaticFiles() - .UseAuthentication() .UseWebSockets() .UseMvc(); } diff --git a/skills/src/csharp/experimental/restaurantbooking/Controllers/BotController.cs b/skills/src/csharp/experimental/restaurantbooking/Controllers/BotController.cs index ff56ffb25a..a82164bebf 100644 --- a/skills/src/csharp/experimental/restaurantbooking/Controllers/BotController.cs +++ b/skills/src/csharp/experimental/restaurantbooking/Controllers/BotController.cs @@ -1,5 +1,6 @@ -using System; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Bot.Builder; +using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions; @@ -8,8 +9,13 @@ namespace RestaurantBooking.Controllers [ApiController] public class BotController : SkillController { - public BotController(IServiceProvider serviceProvider, BotSettingsBase botSettings) - : base(serviceProvider, botSettings) + public BotController( + IBotFrameworkHttpAdapter botFrameworkHttpAdapter, + SkillHttpAdapter skillHttpAdapter, + SkillWebSocketAdapter skillWebSocketAdapter, + IBot bot, + BotSettingsBase botSettings) + : base(botFrameworkHttpAdapter, skillHttpAdapter, skillWebSocketAdapter, bot, botSettings) { } } diff --git a/skills/src/csharp/experimental/restaurantbooking/RestaurantBooking.csproj b/skills/src/csharp/experimental/restaurantbooking/RestaurantBooking.csproj index d0cb8a9d0b..0b7dc45a93 100644 --- a/skills/src/csharp/experimental/restaurantbooking/RestaurantBooking.csproj +++ b/skills/src/csharp/experimental/restaurantbooking/RestaurantBooking.csproj @@ -41,7 +41,8 @@ - + + diff --git a/skills/src/csharp/experimental/restaurantbooking/Startup.cs b/skills/src/csharp/experimental/restaurantbooking/Startup.cs index ca518f3f57..0258a7f0f8 100644 --- a/skills/src/csharp/experimental/restaurantbooking/Startup.cs +++ b/skills/src/csharp/experimental/restaurantbooking/Startup.cs @@ -3,7 +3,6 @@ using System.Linq; using Microsoft.ApplicationInsights; -using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; @@ -15,13 +14,11 @@ using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions; -using Microsoft.Bot.Builder.Solutions.Proactive; using Microsoft.Bot.Builder.Solutions.Responses; using Microsoft.Bot.Builder.Solutions.TaskExtensions; using Microsoft.Bot.Connector.Authentication; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.IdentityModel.Tokens; using RestaurantBooking.Adapters; using RestaurantBooking.Bots; using RestaurantBooking.Dialogs; @@ -77,12 +74,10 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(new CosmosDbStorage(settings.CosmosDb)); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(sp => { var userState = sp.GetService(); var conversationState = sp.GetService(); - var proactiveState = sp.GetService(); return new BotStateSet(userState, conversationState); }); @@ -104,22 +99,6 @@ public void ConfigureServices(IServiceCollection services) new RestaurantBookingMainResponses(), new RestaurantBookingSharedResponses())); - // Configure skill authentication - services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(options => - { - options.Authority = "https://login.microsoftonline.com/microsoft.com"; - options.Audience = settings.MicrosoftAppId; - options.TokenValidationParameters = new TokenValidationParameters - { - ValidIssuer = "https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0", - }; - }); - - // comment out for now to disable whitelist checking - // services.AddSingleton(); - // services.AddSingleton(); - // Configure adapters services.AddTransient(); services.AddTransient(); @@ -140,9 +119,9 @@ public void ConfigureServices(IServiceCollection services) public void Configure(IApplicationBuilder app, IHostingEnvironment env) { _isProduction = env.IsProduction(); - app.UseDefaultFiles() + app.UseBotApplicationInsights() + .UseDefaultFiles() .UseStaticFiles() - .UseAuthentication() .UseWebSockets() .UseMvc(); } diff --git a/skills/src/csharp/pointofinterestskill/pointofinterestskill/Controllers/BotController.cs b/skills/src/csharp/pointofinterestskill/pointofinterestskill/Controllers/BotController.cs index 07f183ec67..f758892e6b 100644 --- a/skills/src/csharp/pointofinterestskill/pointofinterestskill/Controllers/BotController.cs +++ b/skills/src/csharp/pointofinterestskill/pointofinterestskill/Controllers/BotController.cs @@ -1,5 +1,6 @@ -using System; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Bot.Builder; +using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions; @@ -8,8 +9,13 @@ namespace PointOfInterestSkill.Controllers [ApiController] public class BotController : SkillController { - public BotController(IServiceProvider serviceProvider, BotSettingsBase botSettings) - : base(serviceProvider, botSettings) + public BotController( + IBotFrameworkHttpAdapter botFrameworkHttpAdapter, + SkillHttpAdapter skillHttpAdapter, + SkillWebSocketAdapter skillWebSocketAdapter, + IBot bot, + BotSettingsBase botSettings) + : base(botFrameworkHttpAdapter, skillHttpAdapter, skillWebSocketAdapter, bot, botSettings) { } } diff --git a/skills/src/csharp/pointofinterestskill/pointofinterestskill/PointOfInterestSkill.csproj b/skills/src/csharp/pointofinterestskill/pointofinterestskill/PointOfInterestSkill.csproj index 45ab336658..6098563294 100644 --- a/skills/src/csharp/pointofinterestskill/pointofinterestskill/PointOfInterestSkill.csproj +++ b/skills/src/csharp/pointofinterestskill/pointofinterestskill/PointOfInterestSkill.csproj @@ -28,7 +28,8 @@ - + + diff --git a/skills/src/csharp/pointofinterestskill/pointofinterestskill/Startup.cs b/skills/src/csharp/pointofinterestskill/pointofinterestskill/Startup.cs index dbb8e5ceeb..02d730220c 100644 --- a/skills/src/csharp/pointofinterestskill/pointofinterestskill/Startup.cs +++ b/skills/src/csharp/pointofinterestskill/pointofinterestskill/Startup.cs @@ -15,13 +15,11 @@ using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions; -using Microsoft.Bot.Builder.Solutions.Proactive; using Microsoft.Bot.Builder.Solutions.Responses; using Microsoft.Bot.Builder.Solutions.TaskExtensions; using Microsoft.Bot.Connector.Authentication; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.IdentityModel.Tokens; using PointOfInterestSkill.Adapters; using PointOfInterestSkill.Bots; using PointOfInterestSkill.Dialogs; @@ -75,12 +73,10 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(new CosmosDbStorage(settings.CosmosDb)); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(sp => { var userState = sp.GetService(); var conversationState = sp.GetService(); - var proactiveState = sp.GetService(); return new BotStateSet(userState, conversationState); }); @@ -108,18 +104,6 @@ public void ConfigureServices(IServiceCollection services) new RouteResponses(), new POISharedResponses())); - // Configure skill authentication - services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(options => - { - options.Authority = "https://login.microsoftonline.com/microsoft.com"; - options.Audience = settings.MicrosoftAppId; - options.TokenValidationParameters = new TokenValidationParameters - { - ValidIssuer = "https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0", - }; - }); - // Configure adapters services.AddTransient(); services.AddTransient(); @@ -143,7 +127,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) app.UseBotApplicationInsights() .UseDefaultFiles() .UseStaticFiles() - .UseAuthentication() .UseWebSockets() .UseMvc(); } diff --git a/skills/src/csharp/todoskill/todoskill/Controllers/BotController.cs b/skills/src/csharp/todoskill/todoskill/Controllers/BotController.cs index 649b6776d1..3a78b5728f 100644 --- a/skills/src/csharp/todoskill/todoskill/Controllers/BotController.cs +++ b/skills/src/csharp/todoskill/todoskill/Controllers/BotController.cs @@ -1,5 +1,6 @@ -using System; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Bot.Builder; +using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions; @@ -8,8 +9,13 @@ namespace ToDoSkill.Controllers [ApiController] public class BotController : SkillController { - public BotController(IServiceProvider serviceProvider, BotSettingsBase botSettings) - : base(serviceProvider, botSettings) + public BotController( + IBotFrameworkHttpAdapter botFrameworkHttpAdapter, + SkillHttpAdapter skillHttpAdapter, + SkillWebSocketAdapter skillWebSocketAdapter, + IBot bot, + BotSettingsBase botSettings) + : base(botFrameworkHttpAdapter, skillHttpAdapter, skillWebSocketAdapter, bot, botSettings) { } } diff --git a/skills/src/csharp/todoskill/todoskill/Dialogs/ToDoSkillDialogBase.cs b/skills/src/csharp/todoskill/todoskill/Dialogs/ToDoSkillDialogBase.cs index 3c547b6598..c6b0039998 100644 --- a/skills/src/csharp/todoskill/todoskill/Dialogs/ToDoSkillDialogBase.cs +++ b/skills/src/csharp/todoskill/todoskill/Dialogs/ToDoSkillDialogBase.cs @@ -9,7 +9,6 @@ using Microsoft.Bot.Builder.Dialogs; using Microsoft.Bot.Builder.Dialogs.Choices; using Microsoft.Bot.Builder.Skills; -using Microsoft.Bot.Builder.Solutions; using Microsoft.Bot.Builder.Solutions.Authentication; using Microsoft.Bot.Builder.Solutions.Extensions; using Microsoft.Bot.Builder.Solutions.Resources; @@ -58,7 +57,7 @@ public ToDoSkillDialogBase( throw new Exception("You must configure an authentication connection in your bot file before using this component."); } - AddDialog(new MultiProviderAuthDialog(ResponseManager, settings.OAuthConnections)); + AddDialog(new MultiProviderAuthDialog(settings.OAuthConnections)); AddDialog(new TextPrompt(Actions.Prompt)); AddDialog(new ConfirmPrompt(Actions.ConfirmPrompt, null, Culture.English) { Style = ListStyle.SuggestedAction }); } diff --git a/skills/src/csharp/todoskill/todoskill/Startup.cs b/skills/src/csharp/todoskill/todoskill/Startup.cs index fa391c6343..cbc6836081 100644 --- a/skills/src/csharp/todoskill/todoskill/Startup.cs +++ b/skills/src/csharp/todoskill/todoskill/Startup.cs @@ -3,7 +3,6 @@ using System.Linq; using Microsoft.ApplicationInsights; -using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Bot.Builder; @@ -14,13 +13,11 @@ using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions; -using Microsoft.Bot.Builder.Solutions.Proactive; using Microsoft.Bot.Builder.Solutions.Responses; using Microsoft.Bot.Builder.Solutions.TaskExtensions; using Microsoft.Bot.Connector.Authentication; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.IdentityModel.Tokens; using ToDoSkill.Adapters; using ToDoSkill.Bots; using ToDoSkill.Dialogs; @@ -73,12 +70,10 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(new CosmosDbStorage(settings.CosmosDb)); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(sp => { var userState = sp.GetService(); var conversationState = sp.GetService(); - var proactiveState = sp.GetService(); return new BotStateSet(userState, conversationState); }); @@ -104,18 +99,6 @@ public void ConfigureServices(IServiceCollection services) new ToDoSharedResponses(), new ShowToDoResponses())); - // Configure Skill authentication - services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(options => - { - options.Authority = "https://login.microsoftonline.com/microsoft.com"; - options.Audience = settings.MicrosoftAppId; - options.TokenValidationParameters = new TokenValidationParameters - { - ValidIssuer = "https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0", - }; - }); - // Configure adapters services.AddTransient(); services.AddTransient(); @@ -143,7 +126,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) app.UseBotApplicationInsights() .UseDefaultFiles() .UseStaticFiles() - .UseAuthentication() .UseWebSockets() .UseMvc(); } diff --git a/skills/src/csharp/todoskill/todoskill/ToDoSkill.csproj b/skills/src/csharp/todoskill/todoskill/ToDoSkill.csproj index 8d19803a1b..d8cf6e9e15 100644 --- a/skills/src/csharp/todoskill/todoskill/ToDoSkill.csproj +++ b/skills/src/csharp/todoskill/todoskill/ToDoSkill.csproj @@ -35,7 +35,8 @@ - + + diff --git a/templates/Skill-Template/csharp/Sample/SkillSample/Controllers/BotController.cs b/templates/Skill-Template/csharp/Sample/SkillSample/Controllers/BotController.cs index ac1055c5b4..eb76c6ec7e 100644 --- a/templates/Skill-Template/csharp/Sample/SkillSample/Controllers/BotController.cs +++ b/templates/Skill-Template/csharp/Sample/SkillSample/Controllers/BotController.cs @@ -1,16 +1,22 @@ using Microsoft.AspNetCore.Mvc; +using Microsoft.Bot.Builder; +using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions; -using System; namespace SkillSample.Controllers { - [ApiController] - public class BotController : SkillController - { - public BotController(IServiceProvider serviceProvider, BotSettingsBase botSettings) - : base(serviceProvider, botSettings) - { - } - } -} + [ApiController] + public class BotController : SkillController + { + public BotController( + IBotFrameworkHttpAdapter botFrameworkHttpAdapter, + SkillHttpAdapter skillHttpAdapter, + SkillWebSocketAdapter skillWebSocketAdapter, + IBot bot, + BotSettingsBase botSettings) + : base(botFrameworkHttpAdapter, skillHttpAdapter, skillWebSocketAdapter, bot, botSettings) + { + } + } +} \ No newline at end of file diff --git a/templates/Skill-Template/csharp/Sample/SkillSample/SkillSample.csproj b/templates/Skill-Template/csharp/Sample/SkillSample/SkillSample.csproj index 73beb3167e..c9728b9ce1 100644 --- a/templates/Skill-Template/csharp/Sample/SkillSample/SkillSample.csproj +++ b/templates/Skill-Template/csharp/Sample/SkillSample/SkillSample.csproj @@ -62,8 +62,8 @@ - - + + diff --git a/templates/Skill-Template/csharp/Template/Skill/Controllers/BotController.cs b/templates/Skill-Template/csharp/Template/Skill/Controllers/BotController.cs index 6e2abe66bc..515b999545 100644 --- a/templates/Skill-Template/csharp/Template/Skill/Controllers/BotController.cs +++ b/templates/Skill-Template/csharp/Template/Skill/Controllers/BotController.cs @@ -1,16 +1,21 @@ using Microsoft.AspNetCore.Mvc; +using Microsoft.Bot.Builder; +using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions; -using System; namespace $safeprojectname$.Controllers { [ApiController] - public class BotController : SkillController - { - public BotController(IServiceProvider serviceProvider, BotSettingsBase botSettings) - : base(serviceProvider, botSettings) - { - } - } -} +public class BotController : SkillController +{ + public BotController( + IBotFrameworkHttpAdapter botFrameworkHttpAdapter, + SkillHttpAdapter skillHttpAdapter, + SkillWebSocketAdapter skillWebSocketAdapter, + IBot bot, + BotSettingsBase botSettings) + : base(botFrameworkHttpAdapter, skillHttpAdapter, skillWebSocketAdapter, bot, botSettings) + { + } +} \ No newline at end of file diff --git a/templates/Skill-Template/csharp/Template/Skill/Skill.csproj b/templates/Skill-Template/csharp/Template/Skill/Skill.csproj index 73beb3167e..c9728b9ce1 100644 --- a/templates/Skill-Template/csharp/Template/Skill/Skill.csproj +++ b/templates/Skill-Template/csharp/Template/Skill/Skill.csproj @@ -62,8 +62,8 @@ - - + + diff --git a/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/VirtualAssistantSample.csproj b/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/VirtualAssistantSample.csproj index 2e51fb8418..59709a69a3 100644 --- a/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/VirtualAssistantSample.csproj +++ b/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/VirtualAssistantSample.csproj @@ -21,8 +21,8 @@ - - + + diff --git a/templates/Virtual-Assistant-Template/csharp/Template/VA/VA.csproj b/templates/Virtual-Assistant-Template/csharp/Template/VA/VA.csproj index 2a2ac9f31d..c319dfa69b 100644 --- a/templates/Virtual-Assistant-Template/csharp/Template/VA/VA.csproj +++ b/templates/Virtual-Assistant-Template/csharp/Template/VA/VA.csproj @@ -21,8 +21,8 @@ - - + +