I have an MVC application in azure, and it signs in using Azure AD.
This works great. However in the Claims of the user, I want to include Employee Id.
There's a tutorial on this here which allows you to specify a custom ClaimsMappingPolicy and the example they have is actually including the Employee Id, which is perfect. It looks like this:
New-AzureADPolicy -Definition @('{"ClaimsMappingPolicy":{"Version":1,"IncludeBasicClaimSet":"true", "ClaimsSchema": [{"Source":"user","ID":"employeeid","SamlClaimType":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/employeeid","JwtClaimType":"employeeid"},{"Source":"company","ID":"tenantcountry","SamlClaimType":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country","JwtClaimType":"country"}]}}') -DisplayName "IncludeEmployeeIdInClaimsPolicy" -Type "ClaimsMappingPolicy"
However when I configure this mapping policy, I can no longer sign in, because I get this error:
This application is required to be configured with an application-specific signing key. It is either not configured with one, or the key has expired or is not yet valid.
My guess is that I have somehow overridden the default settings, or messed something up in my claims mapping policy.
I don't know what it could be though, as I haven't changed anything else.
My code for authentication is:
Program.cs
// Azure AD
builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"));
and
builder.Services.AddControllersWithViews(options =>
{
var policy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
options.Filters.Add(new AuthorizeFilter(policy));
});
Nothing fancy.
What could I be missing that is generating this error?
