Skip to content

Commit d296c23

Browse files
author
a.i.kuleshov
committed
feat: add query parameters support
1 parent f1164fa commit d296c23

File tree

4 files changed

+4
-24
lines changed

4 files changed

+4
-24
lines changed

config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ngx_module_type=HTTP
22
ngx_addon_name=ngx_http_auth_jwt_module
33
ngx_module_name=$ngx_addon_name
4-
ngx_module_srcs="${ngx_addon_dir}/src/ngx_http_auth_jwt_binary_converters.c ${ngx_addon_dir}/src/ngx_http_auth_jwt_header_processing.c ${ngx_addon_dir}/src/ngx_http_auth_jwt_string.c ${ngx_addon_dir}/src/ngx_http_auth_jwt_module.c ${ngx_addon_dir}/src/ngx_http_auth_jwt_query_processing.c"
4+
ngx_module_srcs="${ngx_addon_dir}/src/ngx_http_auth_jwt_binary_converters.c ${ngx_addon_dir}/src/ngx_http_auth_jwt_header_processing.c ${ngx_addon_dir}/src/ngx_http_auth_jwt_string.c ${ngx_addon_dir}/src/ngx_http_auth_jwt_module.c"
55
ngx_module_libs="-ljansson -ljwt -lm"
66

77
. auto/module

src/ngx_http_auth_jwt_module.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include "ngx_http_auth_jwt_header_processing.h"
1818
#include "ngx_http_auth_jwt_binary_converters.h"
19-
#include "ngx_http_auth_jwt_query_processing.h"
2019
#include "ngx_http_auth_jwt_string.h"
2120

2221
#include <stdio.h>
@@ -547,20 +546,16 @@ static char * getJwt(ngx_http_request_t *r, ngx_str_t auth_jwt_validation_type)
547546
auth_jwt_validation_type.data += sizeof("QUERY=") - 1;
548547
auth_jwt_validation_type.len -= sizeof("QUERY=") - 1;
549548

550-
ngx_log_error(NGX_LOG_DEBUG, r->connection->log, 0, "http thread: \"%V?%V\"", &r->uri, &r->args);
551-
552-
553-
// get value from query
554-
n = get_value_from_query(r, &auth_jwt_validation_type, &jwtQueryVal);
555-
if (n != NGX_ERROR)
549+
// get the value from query
550+
n = ngx_http_arg(r, auth_jwt_validation_type.data, auth_jwt_validation_type.len, &jwtQueryVal);
551+
if (n != NGX_DECLINED)
556552
{
557553
jwtPtr = ngx_str_t_to_char_ptr(r->pool, jwtQueryVal);
558554
}
559555
else
560556
{
561557
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "error get value from query param");
562558
}
563-
564559
}
565560
else if (auth_jwt_validation_type.len > sizeof("COOKIE=") && ngx_strncmp(auth_jwt_validation_type.data, "COOKIE=", sizeof("COOKIE=") - 1)==0)
566561
{

src/ngx_http_auth_jwt_query_processing.c

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/ngx_http_auth_jwt_query_processing.h

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)