kong.plugins.jwt.jwt_parser

Supported algorithms for signing tokens.

Only support HS256 for our use case.

Functions

new (token) Instantiate a JWT parser Parse a JWT and instantiate a JWT parser for further operations Return errors instead of an instance if any encountered
verify_registered_claims (claims_to_verify) Verify registered claims (according to RFC 7519 Section 4.1) Claims are verified by type and a check.
verify_signature (key) Verify a JWT signature Verify the current JWT signature against a given key

Functions


new

Instantiate a JWT parser Parse a JWT and instantiate a JWT parser for further operations Return errors instead of an instance if any encountered
Parameters:
  • token JWT to parse
Returns:
  • JWT parser
  • error if any

verify_registered_claims

Verify registered claims (according to RFC 7519 Section 4.1) Claims are verified by type and a check.
Parameters:
  • claims_to_verify A list of claims to verify.
Returns:
  • A boolean indicating true if no errors zere found
  • A list of errors

verify_signature

Verify a JWT signature Verify the current JWT signature against a given key
Parameters:
  • key Key against which to verify the signature
Returns:
  • A boolean indicating if the signature if verified or not