Skip to content

Commit 98b748b

Browse files
committed
Changed back to auth_jwt_validate_email and additional conf merging code
1 parent a71fc75 commit 98b748b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/ngx_http_auth_jwt_module.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ typedef struct {
2323
ngx_str_t auth_jwt_key;
2424
ngx_flag_t auth_jwt_enabled;
2525
ngx_flag_t auth_jwt_redirect;
26-
ngx_flag_t auth_jwt_email_validation;
26+
ngx_flag_t auth_jwt_validate_email;
2727
ngx_str_t auth_jwt_validation_type;
2828
ngx_str_t auth_jwt_algorithm;
2929

@@ -65,11 +65,11 @@ static ngx_command_t ngx_http_auth_jwt_commands[] = {
6565
offsetof(ngx_http_auth_jwt_loc_conf_t, auth_jwt_redirect),
6666
NULL },
6767

68-
{ ngx_string("auth_jwt_email_validation"),
68+
{ ngx_string("auth_jwt_validate_email"),
6969
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
7070
ngx_conf_set_flag_slot,
7171
NGX_HTTP_LOC_CONF_OFFSET,
72-
offsetof(ngx_http_auth_jwt_loc_conf_t, auth_jwt_email_validation),
72+
offsetof(ngx_http_auth_jwt_loc_conf_t, auth_jwt_validate_email),
7373
NULL },
7474

7575
{ ngx_string("auth_jwt_validation_type"),
@@ -213,7 +213,7 @@ static ngx_int_t ngx_http_auth_jwt_handler(ngx_http_request_t *r)
213213
set_custom_header_in_headers_out(r, &useridHeaderName, &sub_t);
214214
}
215215

216-
if (jwtcf->auth_jwt_email_validation == NULL || !jwtcf->auth_jwt_email_validation)
216+
if (jwtcf->auth_jwt_validate_email == NULL || !jwtcf->auth_jwt_validate_email)
217217
{
218218
email = jwt_get_grant(jwt, "emailAddress");
219219
if (email == NULL)
@@ -355,6 +355,7 @@ ngx_http_auth_jwt_create_loc_conf(ngx_conf_t *cf)
355355
// set the flag to unset
356356
conf->auth_jwt_enabled = (ngx_flag_t) -1;
357357
conf->auth_jwt_redirect = (ngx_flag_t) -1;
358+
conf->auth_jwt_validate_email = (ngx_flag_t) -1;
358359

359360
ngx_conf_log_error(NGX_LOG_DEBUG, cf, 0, "Created Location Configuration");
360361

@@ -371,6 +372,7 @@ ngx_http_auth_jwt_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
371372
ngx_conf_merge_str_value(conf->auth_jwt_loginurl, prev->auth_jwt_loginurl, "");
372373
ngx_conf_merge_str_value(conf->auth_jwt_key, prev->auth_jwt_key, "");
373374
ngx_conf_merge_str_value(conf->auth_jwt_validation_type, prev->auth_jwt_validation_type, "");
375+
ngx_conf_merge_str_value(conf->auth_jwt_algorithm, prev->auth_jwt_algorithm, "");
374376

375377
if (conf->auth_jwt_enabled == ((ngx_flag_t) -1))
376378
{
@@ -382,6 +384,11 @@ ngx_http_auth_jwt_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
382384
conf->auth_jwt_redirect = (prev->auth_jwt_redirect == ((ngx_flag_t) -1)) ? 0 : prev->auth_jwt_redirect;
383385
}
384386

387+
if (conf->auth_jwt_validate_email == ((ngx_flag_t) -1))
388+
{
389+
conf->auth_jwt_validate_email = (prev->auth_jwt_validate_email == ((ngx_flag_t) -1)) ? 0 : prev->auth_jwt_validate_email;
390+
}
391+
385392
return NGX_CONF_OK;
386393
}
387394

0 commit comments

Comments
 (0)