Skip to content

Commit 62929e8

Browse files
committed
More fixes to email validate
1 parent 11b80d5 commit 62929e8

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/ngx_http_auth_jwt_module.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ 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_validate_email == NULL || jwtcf->auth_jwt_validate_email)
216+
// if (jwtcf->auth_jwt_validate_email == NULL || jwtcf->auth_jwt_validate_email == 1)
217+
if (jwtcf->auth_jwt_validate_email == 1)
217218
{
218219
email = jwt_get_grant(jwt, "emailAddress");
219220
if (email == NULL)
@@ -355,7 +356,7 @@ ngx_http_auth_jwt_create_loc_conf(ngx_conf_t *cf)
355356
// set the flag to unset
356357
conf->auth_jwt_enabled = (ngx_flag_t) -1;
357358
conf->auth_jwt_redirect = (ngx_flag_t) -1;
358-
conf->auth_jwt_validate_email = (ngx_flag_t) -1;
359+
// conf->auth_jwt_validate_email = (ngx_flag_t) -1;
359360

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

@@ -372,7 +373,8 @@ ngx_http_auth_jwt_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
372373
ngx_conf_merge_str_value(conf->auth_jwt_loginurl, prev->auth_jwt_loginurl, "");
373374
ngx_conf_merge_str_value(conf->auth_jwt_key, prev->auth_jwt_key, "");
374375
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, "");
376+
ngx_conf_merge_str_value(conf->auth_jwt_algorithm, prev->auth_jwt_algorithm, "HS256");
377+
ngx_conf_merge_off_value(conf->auth_jwt_validate_email, prev->auth_jwt_validate_email, 1);
376378

377379
if (conf->auth_jwt_enabled == ((ngx_flag_t) -1))
378380
{
@@ -384,11 +386,6 @@ ngx_http_auth_jwt_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
384386
conf->auth_jwt_redirect = (prev->auth_jwt_redirect == ((ngx_flag_t) -1)) ? 0 : prev->auth_jwt_redirect;
385387
}
386388

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-
392389
return NGX_CONF_OK;
393390
}
394391

0 commit comments

Comments
 (0)