CFML Component for encoding and decoding JSON Web Tokens (JWT).
This is a port of the node.js project node-jwt-simple to cfml. It currently supports HS256, HS384, and HS512 signing algorithms.
<!--- Initialize the component with the secret signing key --->
<cfset jwt = new jwt(secretkey)>
<cfset payload = {"ts" = now(), "userid" = "jdoe"}>
<!--- Encode the data structure as a json web token --->
<cfset token = jwt.encode(payload)>
<!--- Decode the token and get the data structure back. This is will throw an error if the token is invalid --->
<cfset result = jwt.decode(token)>