@@ -23,7 +23,7 @@ static char * ngx_http_auth_jwt_merge_loc_conf(ngx_conf_t *cf, void *parent, voi
23
23
static int hex_char_to_binary ( char ch , char * ret );
24
24
static int hex_to_binary ( const char * str , u_char * buf , int len );
25
25
26
- static ngx_command_t ngx_http_auth_jwt_commands [] = {
26
+ static ngx_command_t ngx_http_auth_jwt_commands [] = {
27
27
28
28
{ ngx_string ("auth_jwt_loginurl" ),
29
29
NGX_HTTP_MAIN_CONF |NGX_HTTP_SRV_CONF |NGX_HTTP_LOC_CONF |NGX_CONF_TAKE1 ,
@@ -38,19 +38,19 @@ static ngx_command_t ngx_http_auth_jwt_commands[] = {
38
38
NGX_HTTP_LOC_CONF_OFFSET ,
39
39
offsetof(ngx_http_auth_jwt_loc_conf_t , auth_jwt_key ),
40
40
NULL },
41
-
41
+
42
42
{ ngx_string ("auth_jwt_enabled" ),
43
43
NGX_HTTP_MAIN_CONF |NGX_HTTP_SRV_CONF |NGX_HTTP_LOC_CONF |NGX_CONF_FLAG ,
44
44
ngx_conf_set_flag_slot ,
45
45
NGX_HTTP_LOC_CONF_OFFSET ,
46
46
offsetof(ngx_http_auth_jwt_loc_conf_t , auth_jwt_enabled ),
47
47
NULL },
48
48
49
- ngx_null_command
49
+ ngx_null_command
50
50
};
51
51
52
52
53
- static ngx_http_module_t ngx_http_auth_jwt_module_ctx = {
53
+ static ngx_http_module_t ngx_http_auth_jwt_module_ctx = {
54
54
NULL , /* preconfiguration */
55
55
ngx_http_auth_jwt_init , /* postconfiguration */
56
56
@@ -65,7 +65,7 @@ static ngx_http_module_t ngx_http_auth_jwt_module_ctx = {
65
65
};
66
66
67
67
68
- ngx_module_t ngx_http_auth_jwt_module = {
68
+ ngx_module_t ngx_http_auth_jwt_module = {
69
69
NGX_MODULE_V1 ,
70
70
& ngx_http_auth_jwt_module_ctx , /* module context */
71
71
ngx_http_auth_jwt_commands , /* module directives */
@@ -89,7 +89,7 @@ static ngx_int_t ngx_http_auth_jwt_handler(ngx_http_request_t *r)
89
89
ngx_str_t jwtCookieVal ;
90
90
char * jwtCookieValChrPtr ;
91
91
char * return_url ;
92
- ngx_http_auth_jwt_loc_conf_t * jwtcf ;
92
+ ngx_http_auth_jwt_loc_conf_t * jwtcf ;
93
93
u_char * keyBinary ;
94
94
jwt_t * jwt ;
95
95
int jwtParseReturnCode ;
@@ -201,8 +201,8 @@ static ngx_int_t ngx_http_auth_jwt_handler(ngx_http_request_t *r)
201
201
if (request_uri_var && !request_uri_var -> not_found && request_uri_var -> valid )
202
202
{
203
203
// ideally we would like the uri with the querystring parameters
204
- uri .data = ngx_palloc (r -> pool , request_uri_var -> len );
205
- uri .len = request_uri_var -> len ;
204
+ uri .data = ngx_palloc (r -> pool , request_uri_var -> len );
205
+ uri .len = request_uri_var -> len ;
206
206
ngx_memcpy (uri .data , request_uri_var -> data , request_uri_var -> len );
207
207
}
208
208
else
@@ -262,7 +262,7 @@ static ngx_int_t ngx_http_auth_jwt_init(ngx_conf_t *cf)
262
262
static void *
263
263
ngx_http_auth_jwt_create_loc_conf (ngx_conf_t * cf )
264
264
{
265
- ngx_http_auth_jwt_loc_conf_t * conf ;
265
+ ngx_http_auth_jwt_loc_conf_t * conf ;
266
266
267
267
conf = ngx_pcalloc (cf -> pool , sizeof (ngx_http_auth_jwt_loc_conf_t ));
268
268
if (conf == NULL )
@@ -282,45 +282,45 @@ ngx_http_auth_jwt_create_loc_conf(ngx_conf_t *cf)
282
282
static char *
283
283
ngx_http_auth_jwt_merge_loc_conf (ngx_conf_t * cf , void * parent , void * child )
284
284
{
285
- ngx_http_auth_jwt_loc_conf_t * prev = parent ;
286
- ngx_http_auth_jwt_loc_conf_t * conf = child ;
285
+ ngx_http_auth_jwt_loc_conf_t * prev = parent ;
286
+ ngx_http_auth_jwt_loc_conf_t * conf = child ;
287
287
288
288
ngx_conf_merge_str_value (conf -> auth_jwt_loginurl , prev -> auth_jwt_loginurl , "" );
289
289
ngx_conf_merge_str_value (conf -> auth_jwt_key , prev -> auth_jwt_key , "" );
290
290
291
291
292
292
if (conf -> auth_jwt_enabled == ((ngx_flag_t ) - 1 ))
293
293
{
294
- conf -> auth_jwt_enabled = (prev -> auth_jwt_enabled == ((ngx_flag_t ) - 1 )) ? 0 : prev -> auth_jwt_enabled ;
294
+ conf -> auth_jwt_enabled = (prev -> auth_jwt_enabled == ((ngx_flag_t ) - 1 )) ? 0 : prev -> auth_jwt_enabled ;
295
295
}
296
296
297
297
ngx_conf_log_error (NGX_LOG_DEBUG , cf , 0 , "Merged Location Configuration" );
298
298
299
299
// ngx_conf_log_error(NGX_LOG_ERR, cf, 0, "Key: %s, Enabled: %d",
300
300
// conf->auth_jwt_key.data,
301
301
// conf->auth_jwt_enabled);
302
- return NGX_CONF_OK ;
302
+ return NGX_CONF_OK ;
303
303
}
304
304
305
305
static int
306
306
hex_char_to_binary ( char ch , char * ret )
307
307
{
308
- ch = tolower ( ch );
308
+ ch = tolower ( ch );
309
309
if ( isdigit ( ch ) )
310
- * ret = ch - '0' ;
310
+ * ret = ch - '0' ;
311
311
else if ( ch >= 'a' && ch <= 'f' )
312
312
* ret = ( ch - 'a' ) + 10 ;
313
313
else if ( ch >= 'A' && ch <= 'F' )
314
- * ret = ( ch - 'A' ) + 10 ;
314
+ * ret = ( ch - 'A' ) + 10 ;
315
315
else
316
316
return * ret = 0 ;
317
- return 1 ;
317
+ return 1 ;
318
318
}
319
319
320
320
static int
321
321
hex_to_binary ( const char * str , u_char * buf , int len ) {
322
322
u_char
323
- * cpy = buf ;
323
+ * cpy = buf ;
324
324
char
325
325
low ,
326
326
high ;
@@ -337,6 +337,6 @@ hex_to_binary( const char* str, u_char* buf, int len ) {
337
337
338
338
* cpy ++ = low | (high << 4 );
339
339
}
340
- return 0 ;
340
+ return 0 ;
341
341
}
342
342
0 commit comments