Skip to content

Commit 3e0f550

Browse files
authored
Use our fork instead of modding libjwt
Use our fork instead of modding libjwt
1 parent 5f08e17 commit 3e0f550

File tree

1 file changed

+2
-39
lines changed

1 file changed

+2
-39
lines changed

README.md

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,9 @@ This is an NGINX module to check for a valid JWT and proxy to an upstream server
44
# Build Requirements
55
This module depends on the [JWT C Library](https://github.com/benmcollins/libjwt)
66

7-
Unfortunately, this library cannot handle grants that are not strings. In the JWT Spec, some grants, such as "exp" and "iat" are supposed to be stored as integers, not strings. If the JWT is created by another library and an exp is set as an integer, this library will return NULL when you try to get that grant. There is a pull request by another person to address this issue, but it has been on hold for months. I have patched the library myself.
7+
Unfortunately, this library cannot handle grants that are not strings. In the JWT Spec, some grants, such as "exp" and "iat" are supposed to be stored as integers, not strings. If the JWT is created by another library and an exp is set as an integer, this library will return NULL when you try to get that grant. I forked the library and submitted a pull request. For now, you should use [TeslaGov fork of the JWT C Library](https://github.com/TeslaGov/libjwt)
88

9-
I added these lines to jwt.h
10-
11-
```
12-
const char *jwt_get_grant(jwt_t *jwt, const char *grant);
13-
int jwt_get_grant_int(jwt_t *jwt, const char *grant);
14-
```
15-
16-
I added these lines to jwt.c
17-
18-
```
19-
static int get_js_int(json_t *js, const char *key)
20-
{
21-
int val = -1;
22-
json_t *js_val;
23-
24-
js_val = json_object_get(js, key);
25-
if (js_val)
26-
val = (int)json_integer_value(js_val);
27-
28-
return val;
29-
return 0;
30-
}
31-
32-
int jwt_get_grant_int(jwt_t *jwt, const char *grant)
33-
{
34-
if (!jwt || !grant || !strlen(grant)) {
35-
errno = EINVAL;
36-
return 0;
37-
}
38-
39-
errno = 0;
40-
41-
return get_js_int(jwt->grants, grant);
42-
}
43-
```
44-
45-
46-
Transitively, that library depends on a JSON Parser called [Jansson](https://github.com/akheron/jansson) as well as OpenSSL
9+
Transitively, that library depends on a JSON Parser called [Jansson](https://github.com/akheron/jansson) as well as the OpenSSL library.
4710

4811
# NGINX Directives
4912
This module requires several new nginx.conf directives, which can be specified in on the `main` `server` or `___location` level.

0 commit comments

Comments
 (0)