jwt: JSON Web Tokens

Top  Previous  Next

The JSON Web Tokens(JWT) functions are used to encode and decode JWT objects, which are used for e.g. authentication. JWT is specified in RFC 7519.

A JSON Web Token is a string that contains three base64url encoded parts separated by periods. The first part is the header includes information about which algorithm is used to generate the signature, the second part is the payload that specifies a number of claims. The last part is optional and is the signature of the token that verifies that the token is valid.

 

As the tokens can potentially be very long strings, these functions require that the project is built with Large String Support.

 

 

The following functions are used to work with the JWT objects:


jwtCreate

Creates a new, empty JWT object.


jwtFree

Releases a JWT object.


jwtDecodeAsym

Creates a JWT object from a token using asymmetrical encryption.


jwtDecodeSym

Creates a JWT object from a token using symmetrical encryption.


jwtAlgGet

Read the used encryption algorithm.


jwtAlgSetAsym

Set the encryption algorithm to an asymmetrical one.


jwtAlgSetSym

Set the encryption algorithm to a symmetrical one.


jwtEncode

Create an encoded JWT token from the JWT object.

 

The following functions are used to manipulate the JWT headers:


jwtHeaderAdd

Adds a new string header to the JWT object


jwtHeaderAddBool

Adds a new boolean header to the JWT object


jwtHeaderAddDint

Adds a new integer header to the JWT object


jwtHeaderAddJSON

Adds the headers from a JSON encoded string to the JWT object


jwtHeaderDelete

Deletes a header from the JWT object


jwtHeaderGet

Reads a string header from the JWT object.


jwtHeaderGetBool

Reads a boolean header from the JWT object.


jwtHeaderGetDint

Reads an integer header from the JWT object.


jwtHeaderGetJSON

Reads a header from the JWT object as a JSON encoded string.

 

 

The following functions are used to manipulate the JWT claims:


jwtClaimAdd

Adds a new string claim to the JWT object


jwtClaimAddBool

Adds a new boolean claim to the JWT object


jwtClaimAddDint

Adds a new integer claim to the JWT object


jwtClaimAddJSON

Adds the claims from a JSON encoded string to the JWT object


jwtClaimDelete

Deletes a claim from the JWT object


jwtClaimGet

Reads a string claim from the JWT object.


jwtClaimGetBool

Reads a boolean claim from the JWT object.


jwtClaimGetDint

Reads an integer claim from the JWT object.


jwtClaimGetJSON

Reads a claim from the JWT object as a JSON encoded string.