From 65bcf482461e579b860abe05f441d8c01e106bce Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Fri, 23 Jun 2017 18:45:20 +0200 Subject: [PATCH] Dealing with auth and package versions issues between 1.1 and 2.0 --- .../DataProtection/DataProtection.csproj | 5 +++++ .../Identity/Identity.API/Identity.API.csproj | 1 - src/Web/WebMVC/Startup.cs | 11 +++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj index 69b23a145..a8024b7e5 100644 --- a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj +++ b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj @@ -3,11 +3,16 @@ netstandard1.5 Microsoft.eShopOnContainers.BuildingBlocks + + + diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index d31664a2b..4f175503c 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -3,7 +3,6 @@ netcoreapp1.1 1.1.2 - Exe aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5 $(PackageTargetFallback);dotnet5.6;portable-net45+win8 ..\..\..\..\docker-compose.dcproj diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index 7fe05da02..f07fb21c7 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -83,7 +83,7 @@ namespace Microsoft.eShopOnContainers.WebMVC var callBackUrl = Configuration.GetValue("CallBackUrl"); // Add Authentication services services.AddCookieAuthentication(CookieAuthenticationDefaults.AuthenticationScheme); - services.AddOpenIdConnectAuthentication("Oidc", options => + services.AddOpenIdConnectAuthentication(OpenIdConnectDefaults.AuthenticationScheme, options => { options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.Authority = identityUrl.ToString(); @@ -101,8 +101,11 @@ namespace Microsoft.eShopOnContainers.WebMVC options.Scope.Add("marketing"); }); - services.AddAuthentication(sharedOptions => sharedOptions.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme); - + services.AddAuthentication(options => { + options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme; + options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; + options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme; + }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -125,7 +128,7 @@ namespace Microsoft.eShopOnContainers.WebMVC app.UseStaticFiles(); - + app.UseAuthentication(); var log = loggerFactory.CreateLogger("identity");