You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why?
In the same way Microsoft.IdentityModel.Validators proposes a specific implementation of issuer validators for AAD AadIssuerValidator, also provide an AAD specific implementation for the signing key issuer validator.
How to use?
Add a reference to Microsoft.IdentityModel.Validators 6.32.0+ to your project. As usual, update all the versions of Microsoft.IdentityModel to the same version.
In the part of your code that sets the token validation parameters to validate tokens:
Reference the Microsoft.IdentityModel.Validators namespace: using Microsoft.IdentityModel.Validators;
Find the part that sets the TokenValidationParameters, and add the following line: tokenValidationParameters.EnableAadSigningKeyIssuerValidation();
Example
builder.AddJwtBearer(options =>{options.Authority= ...;options.TokenValidationParameters=newTokenValidationParameters(){// Usual parameters.};// The following lines Azure AD signing key issuer validation.options.TokenValidationParameters.EnableAadSigningKeyIssuerValidation();options.Events.OnMessageReceived=async context =>{context.Options.TokenValidationParameters.ConfigurationManager??=options.ConfigurationManagerasBaseConfigurationManager;awaitTask.CompletedTask.ConfigureAwait(false);};}
The text was updated successfully, but these errors were encountered:
Why?
In the same way Microsoft.IdentityModel.Validators proposes a specific implementation of issuer validators for AAD AadIssuerValidator, also provide an AAD specific implementation for the signing key issuer validator.
How to use?
Add a reference to Microsoft.IdentityModel.Validators 6.32.0+ to your project. As usual, update all the versions of Microsoft.IdentityModel to the same version.
In the part of your code that sets the token validation parameters to validate tokens:
Reference the Microsoft.IdentityModel.Validators namespace:
using Microsoft.IdentityModel.Validators;
Find the part that sets the
TokenValidationParameters
, and add the following line:tokenValidationParameters.EnableAadSigningKeyIssuerValidation();
Example
The text was updated successfully, but these errors were encountered: