public static void AddJsonWebToken( this AuthenticationConfiguration configuration, string issuer, string audience, X509Certificate2 signingCertificate, Dictionary <string, string> claimMappings = null) { var validationParameters = new TokenValidationParameters() { AllowedAudience = audience, SigningToken = new X509SecurityToken(signingCertificate), ValidIssuer = issuer, }; configuration.AddJsonWebToken( validationParameters, AuthenticationOptions.ForAuthorizationHeader(JwtConstants.Bearer), AuthenticationScheme.SchemeOnly(JwtConstants.Bearer), claimMappings); }
public static void AddJsonWebToken( this AuthenticationConfiguration configuration, string issuer, string audience, string signingKey, Dictionary <string, string> claimMappings = null) { var validationParameters = new TokenValidationParameters() { AllowedAudience = audience, SigningToken = new BinarySecretSecurityToken(Convert.FromBase64String(signingKey)), ValidIssuer = issuer, }; configuration.AddJsonWebToken( validationParameters, AuthenticationOptions.ForAuthorizationHeader(JwtConstants.Bearer), AuthenticationScheme.SchemeOnly(JwtConstants.Bearer), claimMappings); }