diff --git a/src/BuildingBlocks/BuildingBlocks.csproj b/src/BuildingBlocks/BuildingBlocks.csproj index d48bf55..209c5e7 100644 --- a/src/BuildingBlocks/BuildingBlocks.csproj +++ b/src/BuildingBlocks/BuildingBlocks.csproj @@ -19,6 +19,7 @@ + diff --git a/src/BuildingBlocks/Jwt/JwtExtensions.cs b/src/BuildingBlocks/Jwt/JwtExtensions.cs index e526541..d1f899e 100644 --- a/src/BuildingBlocks/Jwt/JwtExtensions.cs +++ b/src/BuildingBlocks/Jwt/JwtExtensions.cs @@ -1,6 +1,7 @@ using BuildingBlocks.Utils; using BuildingBlocks.Web; using Duende.IdentityServer.Models; +using IdentityServer4.AccessTokenValidation; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Extensions.DependencyInjection; @@ -12,7 +13,12 @@ public static IServiceCollection AddJwt(this IServiceCollection services) { var jwtOptions = services.GetOptions("Jwt"); - services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) + services.AddAuthentication(options => + { + options.DefaultScheme = IdentityServerAuthenticationDefaults.AuthenticationScheme; + options.DefaultAuthenticateScheme = IdentityServerAuthenticationDefaults.AuthenticationScheme; + options.DefaultChallengeScheme = IdentityServerAuthenticationDefaults.AuthenticationScheme; + }) .AddJwtBearer(JwtBearerDefaults.AuthenticationScheme, options => { options.Authority = jwtOptions.Authority; @@ -32,4 +38,4 @@ public static IServiceCollection AddJwt(this IServiceCollection services) return services; } -} +} \ No newline at end of file