add session state to the info hook
@@ -2813,6 +2813,11 @@ static int oidc_handle_remove_at_cache(request_rec *r, oidc_cfg *c) {
#define OIDC_HOOK_INFO_ACCES_TOKEN_EXP "access_token_expires"
#define OIDC_HOOK_INFO_USER_INFO "userinfo"
#define OIDC_HOOK_INFO_CONTENT_TYPE_JSON "application/json"
+#define OIDC_HOOK_INFO_SESSION "session"
+#define OIDC_HOOK_INFO_SESSION_STATE "state"
+#define OIDC_HOOK_INFO_SESSION_UUID "uuid"
+#define OIDC_HOOK_INFO_SESSION_EXP "exp"
+#define OIDC_HOOK_INFO_SESSION_REMOTE_USER "remote_user"
/*
* handle request for session info
@@ -2871,6 +2876,16 @@ static int oidc_handle_info_request(request_rec *r, oidc_cfg *c,
if (claims)
json_object_set_new(json, OIDC_HOOK_INFO_USER_INFO, claims);
+ json_t *j_session = json_object();
+ json_object_set(j_session, OIDC_HOOK_INFO_SESSION_STATE, session->state);
+ json_object_set_new(j_session, OIDC_HOOK_INFO_SESSION_UUID,
+ json_string(session->uuid));
+ json_object_set_new(j_session, OIDC_HOOK_INFO_SESSION_EXP,
+ json_integer(apr_time_sec(session->expiry)));
+ json_object_set_new(j_session, OIDC_HOOK_INFO_SESSION_REMOTE_USER,
+ json_string(session->remote_user));
+ json_object_set_new(json, OIDC_HOOK_INFO_SESSION, j_session);
+
/* JSON-encode the result */
char *s_value = json_dumps(json, 0);
char *r_value = apr_pstrdup(r->pool, s_value);
