Skip to content

Commit 12ca68e

Browse files
committed
add a new article
1 parent 3372410 commit 12ca68e

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: ASP.NET MVC application error WIF10201: No valid key mapping found for securityToken
3+
description: This article provides guidance for troubleshooting the the error "WIF10201- No valid key mapping found for securityToken".
4+
author: genlin
5+
ms.author: bachoang
6+
ms.service: entra-id
7+
ms.topic: troubleshooting-general
8+
ms.date: 02/05/2025
9+
ms.custom: sap:Issues Signing In to Applications
10+
---
11+
# WIF10201: No valid key mapping found for securityToken in ASP.NET MVC application
12+
13+
This article provides guidance for troubleshooting an authentication issue in an ASP.NET MVC application that uses both [WS-Federation](https://github.com/Azure-Samples/active-directory-dotnet-webapp-wsfederation) OWIN middleware and [Windows Identity Foundation](../../../windows-server/user-profiles-and-logon/windows-identity-foundation.md) (WIF) to authenticate to Microsoft Entra ID.
14+
15+
## Symptom
16+
17+
The ASP.NET MVC application was working previously; however, the following error is now occurring without any changes to the application.
18+
19+
```dotnetcli
20+
Error Details:
21+
Server Error in ‘/’ Application.
22+
WIF10201: No valid key mapping found for securityToken: ‘System.IdentityModel.Tokens.X509SecurityToken’ and issuer: ‘https://sts.windows.net/<Directory ID>/’.
23+
24+
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
25+
26+
Exception Details: System.IdentityModel.Tokens.SecurityTokenValidationException: WIF10201: No valid key mapping found for securityToken: ‘System.IdentityModel.Tokens.X509SecurityToken’ and issuer: ‘https://sts.windows.net/<Directory ID>/’.
27+
```
28+
29+
## Cause
30+
31+
Windows Identity Foundation uses the certificate thumbprint(s) in the web.config file (shown below) to verify the signature of the token returned from THE Entra ID upon successful sign in.
32+
33+
```
34+
<issuerNameRegistry type="System.IdentityModel.Tokens.ValidatingIssuerNameRegistry,
35+
System.IdentityModel.Tokens.ValidatingIssuerNameRegistry">
36+
<authority name="https://sts.windows.net/<Directory ID>/">
37+
<keys>
38+
<add thumbprint="C142E..." />
39+
<add thumbprint="8BA94..." />
40+
<add thumbprint="D92E1..." />
41+
</keys>
42+
<validIssuers>
43+
<add name="https://sts.windows.net/<Directory ID>/" />
44+
</validIssuers>
45+
</authority>
46+
</issuerNameRegistry>
47+
```
48+
49+
The error WIF10201 occurs when none of these certificate thumbprints match the one used by Entra ID to sign the token.
50+
51+
The Entra ID uses a [signing key rollover mechanism](entra/identity-platform/signing-key-rollover), which updates the certificate used to sign authentication tokens periodically. This key rollover causes the initial certificate thumbprints configured in the web.config file to become invalid, hence leading to the error.
52+
53+
### Solution
54+
55+
You can either update the certificate thumbprints in the web.config file manually or automate the process through code. For more information, see [Best practices for keys metadata caching and validation](/entra/identity-platform/signing-key-rollover#best-practices-for-keys-metadata-caching-and-validation)

0 commit comments

Comments
 (0)