google / jwt_verify_lib

Provide c++ library to verify JWT tokens
Apache License 2.0
42 stars 43 forks source link

Add HS256 support #28

Closed ryanchapman closed 5 years ago

ryanchapman commented 5 years ago

Our company uses HS256 for JWT verification in a system, and we'd like to be able to use Envoy and Istio, so this PR adds support for that algorithm.

Example envoy config that uses the HS256 key secret (to anyone reading this, your key should be at least 32 bytes (256/8=32), not 6):

http_filters:
- name: envoy.filters.http.jwt_authn
  config:
    providers:
      sample_jwt_provider:
        issuer: sample.com
        local_jwks:
          inline_string: "{\"keys\": [{\"kty\":\"oct\",\"k\":\"c2VjcmV0\",\"alg\":\"HS256\"}]}"
        forward: true
        forward_payload_header: "plain-authorization"
    rules:
    - match:
        prefix: /protect
      requires:
        provider_name: sample_jwt_provider