POC: Validate JWT with iRule
Code is community submitted, community supported, and recognized as ‘Use At Your Own Risk’.
Short Description
This is a proof of concept iRule to decode and validate a JWT submitted in the HTTP Authorization header. It supports only JWT's signed with RS256 and was roughly tested with Azure, Okta and ADFS tokens.
It is not designed for production usage, especially there are more checks required to comply with https://datatracker.ietf.org/doc/html/rfc7519#section-7.2.
Problem solved by this Code Snippet
Decode and validate a JWT with an iRule.
How to use this Code Snippet
Attach it to a VS and adapt the public key(s) and key id(s).
Code Snippet Meta Information
- Version: POC
- Coding Language: iRule
Full Code Snippet
https://github.com/JuergenMang/f5-irules-jwt/blob/main/jwt-validate
There is now also a GitHub repository: https://github.com/JuergenMang/f5-irules-jwt
I added antoher iRule to create and sign a JWT: https://community.f5.com/t5/codeshare/poc-create-and-sign-a-jwt-with-irule/ta-p/326948
Thanks for sharing your efforts Juergen_Mang!
True MVP!