Skip to main content
100%

Gist 86a2162840809aa2b4e4890ec2ba7100

✓ Published0🌍 Public
CCarlos-Augusto
Last edited Oct 13, 2020
Created on Oct 13, 2020

This example demonstrates how to create and validate a JSON Web Token (JWT) using the Scala library `pdi.jwt` with ES256 asymmetric encryption. It shows the complete token lifecycle: generating a key pair with `GeneratorKeyFactory` on the `PRIME256V1` curve, encoding claims (including custom fields like `role` and `env`), and finally decoding and verifying the token with the public key. The code serializes claims using `org.json4s` and `jackson.compactJson`, highlighting the interplay between JWT construction, cryptographic signing, and verification.

AI-generated description

Similar vizzes