I have an ASP.NET Core application that is using WSFederation as authentication protocol. The application authenticates through our internal ADFS server where a corresponding Relying Party is configured. When attempting to authenticate, the ASP.NET Core application returns the following error message:
SecurityTokenException: No token validator was found for the given token.
Here is the full error page:
I had a look at the application configuration, but everything looked fine there:
The issue turned out to be related to the Relying Party configuration in ADFS. I had enabled token encryption there but this is not supported by the WSFederation middleware in ASP.NET Core.
Here is how to fix it:
- Go to your ADFS server
- Open ADFS Management
- Go to Relying Parties and click on the Relying Party you want to configure
- Go to the Encryption tab and click Remove to delete the existing certificate