Skip to content

Commit 24c8b1d

Browse files
author
Hans Zandbelt
committed
pass JSON objects in app HTTP headers as plain JSON
1 parent d86f6df commit 24c8b1d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/util.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,11 @@ void oidc_util_set_app_headers(request_rec *r, const json_t *j_attrs, const char
11371137
s_key = json_object_iter_key(iter);
11381138
j_value = json_object_iter_value(iter);
11391139

1140+
// char *s_value= json_dumps(j_value, JSON_ENCODE_ANY);
1141+
// oidc_util_set_app_header(r, s_key, s_value, claim_prefix);
1142+
// free(s_value);
1143+
1144+
11401145
/* check if it is a single value string */
11411146
if (json_is_string(j_value)) {
11421147

@@ -1169,6 +1174,13 @@ void oidc_util_set_app_headers(request_rec *r, const json_t *j_attrs, const char
11691174
apr_psprintf(r->pool, "%lf", json_real_value(j_value)),
11701175
claim_prefix);
11711176

1177+
} else if (json_is_object(j_value)) {
1178+
1179+
/* set json value in the application header whose name is based on the key and the prefix */
1180+
char *s_value= json_dumps(j_value, 0);
1181+
oidc_util_set_app_header(r, s_key, s_value, claim_prefix);
1182+
free(s_value);
1183+
11721184
/* check if it is a multi-value string */
11731185
} else if (json_is_array(j_value)) {
11741186

0 commit comments

Comments
 (0)