Skip to content

Commit a43a64a

Browse files
committed
need declined when target token is NULL
Signed-off-by: Hans Zandbelt <[email protected]>
1 parent bf468b9 commit a43a64a

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/ngx_sts_module.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ static ngx_int_t ngx_sts_post_config(ngx_conf_t *cf)
303303

304304
static ngx_int_t ngx_sts_handler(ngx_http_request_t *r)
305305
{
306-
ngx_int_t rv = NGX_ERROR;
306+
ngx_int_t rv = NGX_DECLINED;
307307
bool rc = false;
308308
oauth2_nginx_request_context_t *ctx = NULL;
309309
ngx_sts_config *cfg = NULL;
@@ -360,18 +360,15 @@ static ngx_int_t ngx_sts_handler(ngx_http_request_t *r)
360360
target_token ? target_token : "(null)", rc);
361361

362362
if (rc == false) {
363-
if (status_code < 500) {
364-
r->headers_out.status = NGX_HTTP_UNAUTHORIZED;
365-
} else {
366-
r->headers_out.status = (ngx_uint_t)status_code;
367-
}
363+
r->headers_out.status = (status_code < 500)
364+
? NGX_HTTP_UNAUTHORIZED
365+
: (ngx_uint_t)status_code;
366+
rv = NGX_ERROR;
368367
goto end;
369368
}
370369

371-
if (target_token == NULL) {
372-
rv = NGX_DONE;
370+
if (target_token == NULL)
373371
goto end;
374-
}
375372

376373
cfg->target_token.len = strlen(target_token);
377374
cfg->target_token.data = ngx_palloc(r->pool, cfg->target_token.len);

0 commit comments

Comments
 (0)