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