JWT claims as described in https://auth0.com/docs/tokens/concepts/jwt-claims.
More...
#include "version.h"
#include <stdlib.h>
Go to the source code of this file.
◆ L8W8JWT_CLAIM_TYPE_ARRAY
#define L8W8JWT_CLAIM_TYPE_ARRAY 5 |
JWT claim value type JSON array (e.g. "ids": [2, 4, 8, 16]
).
◆ L8W8JWT_CLAIM_TYPE_BOOLEAN
#define L8W8JWT_CLAIM_TYPE_BOOLEAN 3 |
JWT claim value is a boolean (e.g. "done": true
).
◆ L8W8JWT_CLAIM_TYPE_INTEGER
#define L8W8JWT_CLAIM_TYPE_INTEGER 1 |
JWT claim value is an integer (e.g. "exp": 1579610629
)
◆ L8W8JWT_CLAIM_TYPE_NULL
#define L8W8JWT_CLAIM_TYPE_NULL 4 |
JWT claim value is null (e.g. "ref": null
).
◆ L8W8JWT_CLAIM_TYPE_NUMBER
#define L8W8JWT_CLAIM_TYPE_NUMBER 2 |
JWT claim value type number (e.g. "size": 1.85
).
◆ L8W8JWT_CLAIM_TYPE_OBJECT
#define L8W8JWT_CLAIM_TYPE_OBJECT 6 |
JWT claim value type is a JSON object (e.g. "objs": { "name": "GMan", "id": 420 }
).
◆ L8W8JWT_CLAIM_TYPE_OTHER
#define L8W8JWT_CLAIM_TYPE_OTHER 7 |
JWT claim value is some other type.
◆ L8W8JWT_CLAIM_TYPE_STRING
#define L8W8JWT_CLAIM_TYPE_STRING 0 |
JWT claim value is a string (e.g. "iss": "glitchedpolygons.com"
).
◆ l8w8jwt_free_claims()
L8W8JWT_API void l8w8jwt_free_claims |
( |
struct l8w8jwt_claim * |
claims, |
|
|
size_t |
claims_count |
|
) |
| |
Frees a heap-allocated l8w8jwt_claim
array.
- Parameters
-
claims | The claims to free. |
claims_count | The size of the passed claims array. |
◆ l8w8jwt_get_claim()
L8W8JWT_API struct l8w8jwt_claim * l8w8jwt_get_claim |
( |
struct l8w8jwt_claim * |
claims, |
|
|
size_t |
claims_count, |
|
|
const char * |
key, |
|
|
size_t |
key_length |
|
) |
| |
Gets a claim by key from a l8w8jwt_claim array.
- Parameters
-
claims | The array to look in. |
claims_count | The claims array size. |
key | The claim key (e.g. "sub") to look for. |
key_length | The claim key's string length. |
- Returns
- The found claim;
NULL
if no such claim was found in the array.
◆ l8w8jwt_write_claims()
L8W8JWT_API int l8w8jwt_write_claims |
( |
struct chillbuff * |
stringbuilder, |
|
|
struct l8w8jwt_claim * |
claims, |
|
|
size_t |
claims_count |
|
) |
| |
Writes a bunch of JWT claims into a chillbuff stringbuilder.
Curly braces and trailing commas won't be written; only the "key":"value" pairs!
- Parameters
-
stringbuilder | The buffer into which to write the claims. |
claims | The l8w8jwt_claim array of claims to write. |
claims_count | The claims array size. |
- Returns
- Return code as specified inside retcodes.h