Skip to content

Commit

Permalink
optimize performance when OIDCPassClaimsAs none is set
Browse files Browse the repository at this point in the history
Signed-off-by: Hans Zandbelt <[email protected]>
  • Loading branch information
zandbelt committed Feb 28, 2024
1 parent b9bb42c commit b2f933e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
02/28/2024
- optimize performance by skipping JSON processing when `OIDCPassClaimsAs none` is set

02/25/2024
- implement oidc_util_apr_hash_clear so clearing hashtables works with older versions of libapr
- refactor/extract HTTP functions
Expand Down
12 changes: 9 additions & 3 deletions src/mod_auth_openidc.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,13 @@ static apr_byte_t oidc_set_app_claims(request_rec *r, const oidc_cfg *const cfg,

json_t *j_claims = NULL;

apr_byte_t pass_headers = oidc_cfg_dir_pass_info_in_headers(r);
apr_byte_t pass_envvars = oidc_cfg_dir_pass_info_in_envvars(r);

// optimize performance when `OIDCPassClaimsAs none` is set
if ((pass_headers == FALSE) && (pass_headers == FALSE))
return TRUE;

/* decode the string-encoded attributes in to a JSON structure */
if (s_claims != NULL) {
if (oidc_util_decode_json_object(r, s_claims, &j_claims) == FALSE)
Expand All @@ -555,9 +562,8 @@ static apr_byte_t oidc_set_app_claims(request_rec *r, const oidc_cfg *const cfg,

/* set the resolved claims a HTTP headers for the application */
if (j_claims != NULL) {
oidc_util_set_app_infos(r, j_claims, oidc_cfg_claim_prefix(r), cfg->claim_delimiter,
oidc_cfg_dir_pass_info_in_headers(r), oidc_cfg_dir_pass_info_in_envvars(r),
oidc_cfg_dir_pass_info_encoding(r));
oidc_util_set_app_infos(r, j_claims, oidc_cfg_claim_prefix(r), cfg->claim_delimiter, pass_headers,
pass_envvars, oidc_cfg_dir_pass_info_encoding(r));

/* release resources */
json_decref(j_claims);
Expand Down

0 comments on commit b2f933e

Please sign in to comment.