From be6e276bffbfb6bf81761d18bb2fe7d0a8be279c Mon Sep 17 00:00:00 2001 From: Unai Zorrilla Castro Date: Thu, 14 Sep 2017 18:52:29 +0200 Subject: [PATCH] Fix issue with AddAuthentication and no default Schema on Marketing.API --- src/Services/Marketing/Marketing.API/Startup.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Services/Marketing/Marketing.API/Startup.cs b/src/Services/Marketing/Marketing.API/Startup.cs index d8db51682..4dd50e7d4 100644 --- a/src/Services/Marketing/Marketing.API/Startup.cs +++ b/src/Services/Marketing/Marketing.API/Startup.cs @@ -21,6 +21,7 @@ using Infrastructure.Services; using IntegrationEvents.Events; using Marketing.API.IntegrationEvents.Handlers; + using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.EntityFrameworkCore.Diagnostics; using RabbitMQ.Client; using Swashbuckle.AspNetCore.Swagger; @@ -199,8 +200,12 @@ // prevent from mapping "sub" claim to nameidentifier. JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); - services.AddAuthentication() - .AddJwtBearer(options => + services.AddAuthentication(options=> + { + options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; + options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; + + }).AddJwtBearer(options => { options.Authority = Configuration.GetValue("IdentityUrl"); options.Audience = "marketing";