-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
I'm tryining to use both AutoMapper and Mediatr in a Blazor Webassembly porject.
Mediatr was working fine, until I tried to add AutoMapper for some DTO conversion.
I'm loading License keys from appsettings using an extension method. I'm using the same pattern in the API, with no problem.
I have checked return values of GetMediatrLicenseKey() and GetAutoMapperLicenseKey() respectively. They return correct License keys.
Btw. adding the License keys directly make no change.
Another user suggested adding a reference to Microsoft.IdentityModel.JsonWebTokens
#4571 (comment)
This didn't solve the problem
// Register Mediatr
builder.Services.AddMediatR(cfg =>
{
cfg.LicenseKey = builder.Configuration.GetMediatrLicenseKey();
cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly());
});
// Register AutoMapper
builder.Services.AddAutoMapper(cfg => cfg.LicenseKey = builder.Configuration.GetAutoMapperLicenseKey(), Assembly.GetAssembly(typeof(CompetitionMappingProfile)));
Error message in Chrome debugger:
blazor.webassembly.js:1 Debugging hotkey: Shift+Alt+D (when application has focus)
blazor.webassembly.js:1 crit: LuckyPennySoftware.MediatR.License[0]
Error validating the Lucky Penny software license key
Microsoft.IdentityModel.Tokens.SecurityTokenInvalidSignatureException: IDX10511: Signature validation failed. Keys tried: 'Microsoft.IdentityModel.Tokens.RsaSecurityKey, KeyId: 'LuckyPennySoftwareLicenseKey/bbb13acb59904d89b4cb1c85f088ccf9', InternalId: 'N56oP13R41MdxD2pkWSTprdH6al1kOe02PaW-jmlf-c'. , KeyId: LuckyPennySoftwareLicenseKey/bbb13acb59904d89b4cb1c85f088ccf9
'.
Number of keys in TokenValidationParameters: '1'.
Number of keys in Configuration: '0'.
Matched key was in 'TokenValidationParameters'.
kid: 'LuckyPennySoftwareLicenseKey/bbb13acb59904d89b4cb1c85f088ccf9'.
Exceptions caught:
'[PII of type 'System.Text.StringBuilder' is hidden. For more details, see https://aka.ms/IdentityModel/PII.]'.
token: '[PII of type 'Microsoft.IdentityModel.JsonWebTokens.JsonWebToken' is hidden. For more details, see https://aka.ms/IdentityModel/PII.]'. See https://aka.ms/IDX10511 for details.
at Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler.ValidateSignature(:7219/JsonWebToken jwtToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
at Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler.ValidateSignatureAndIssuerSecurityKey(:7219/JsonWebToken jsonWebToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
at Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler.ValidateJWSAsync(:7219/JsonWebToken jsonWebToken, TokenValidationParameters validationParameters, BaseConfiguration configuration)
``
Metadata
Metadata
Assignees
Labels
No labels