diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/Common/Authentication/AuthenticationBuilderExtensions.cs b/src/Digdir.Domain.Dialogporten.GraphQL/Common/Authentication/AuthenticationBuilderExtensions.cs index f5a8a32e3..660c27cf8 100644 --- a/src/Digdir.Domain.Dialogporten.GraphQL/Common/Authentication/AuthenticationBuilderExtensions.cs +++ b/src/Digdir.Domain.Dialogporten.GraphQL/Common/Authentication/AuthenticationBuilderExtensions.cs @@ -1,6 +1,7 @@ using Microsoft.IdentityModel.Tokens; using Microsoft.AspNetCore.Authentication.JwtBearer; using System.Diagnostics; +using System.IdentityModel.Tokens.Jwt; namespace Digdir.Domain.Dialogporten.GraphQL.Common.Authentication; @@ -22,6 +23,10 @@ public static IServiceCollection AddDialogportenAuthentication( services.AddSingleton(); + // Turn off mapping InboundClaims names to its longer version + // "acr" => "http://schemas.microsoft.com/claims/authnclassreference" + JwtSecurityTokenHandler.DefaultMapInboundClaims = false; + var authenticationBuilder = services.AddAuthentication(); foreach (var schema in jwtTokenSchemas) diff --git a/src/Digdir.Domain.Dialogporten.WebApi/Common/Authentication/AuthenticationBuilderExtensions.cs b/src/Digdir.Domain.Dialogporten.WebApi/Common/Authentication/AuthenticationBuilderExtensions.cs index 52e17c184..e0d8a3981 100644 --- a/src/Digdir.Domain.Dialogporten.WebApi/Common/Authentication/AuthenticationBuilderExtensions.cs +++ b/src/Digdir.Domain.Dialogporten.WebApi/Common/Authentication/AuthenticationBuilderExtensions.cs @@ -1,6 +1,7 @@ using Microsoft.IdentityModel.Tokens; using Microsoft.AspNetCore.Authentication.JwtBearer; using System.Diagnostics; +using System.IdentityModel.Tokens.Jwt; namespace Digdir.Domain.Dialogporten.WebApi.Common.Authentication; @@ -24,6 +25,10 @@ public static IServiceCollection AddDialogportenAuthentication( services.AddSingleton(); + // Turn off mapping InboundClaims names to its longer version + // "acr" => "http://schemas.microsoft.com/claims/authnclassreference" + JwtSecurityTokenHandler.DefaultMapInboundClaims = false; + var authenticationBuilder = services.AddAuthentication(); foreach (var schema in jwtTokenSchemas)