Skip to content

Commit e8c0c8d

Browse files
committed
logout: revoke tokens with a configurable JWT auth "aud" value
when revoking tokens at the revocation endpoint (upon logout) with client_secret_jwt or private_key_jwt, use the revocatoin endpoint as "aud" value (instead of the token endpoint that was used before), unless environment variable OIDC_TOKEN_REVOCATION_AUD is set to "token" (or another literal aud value) Signed-off-by: Hans Zandbelt <[email protected]>
1 parent d896eea commit e8c0c8d

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
09/27/2025
2+
- logout: when revoking tokens at the revocation endpoint with client_secret_jwt or
3+
private_key_jwt, use the revocatoin endpoint as "aud" value (instead of the token endpoint
4+
that was used before), unless environment variable OIDC_TOKEN_REVOCATION_AUD is set to
5+
"token" (or another literal aud value)
6+
17
09/13/2025
28
- redis: apply global (server-wide) locking when system(!) environment variable
39
OIDC_REDIS_MUTEX_GLOBAL is set, for backwards compatibility, through:

src/handle/logout.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848

4949
#define OIDC_DONT_REVOKE_TOKENS_BEFORE_LOGOUT_ENVVAR "OIDC_DONT_REVOKE_TOKENS_BEFORE_LOGOUT"
5050

51+
#define OIDC_TOKEN_REVOCATION_AUD_ENV_VAR "OIDC_TOKEN_REVOCATION_AUD"
52+
5153
/*
5254
* revoke refresh token and access token stored in the session if the
5355
* OP has an RFC 7009 compliant token revocation endpoint
@@ -85,7 +87,9 @@ static void oidc_logout_revoke_tokens(request_rec *r, oidc_cfg_t *c, oidc_sessio
8587
r, c, oidc_cfg_provider_token_endpoint_auth_get(provider),
8688
oidc_cfg_provider_token_endpoint_auth_alg_get(provider), oidc_cfg_provider_client_id_get(provider),
8789
oidc_cfg_provider_client_secret_get(provider), oidc_cfg_provider_client_keys_get(provider),
88-
oidc_proto_profile_token_endpoint_auth_aud(provider), params, NULL, &basic_auth, &bearer_auth) == FALSE)
90+
oidc_proto_profile_revocation_endpoint_auth_aud(
91+
provider, apr_table_get(r->subprocess_env, OIDC_TOKEN_REVOCATION_AUD_ENV_VAR)),
92+
params, NULL, &basic_auth, &bearer_auth) == FALSE)
8993
goto out;
9094

9195
token = oidc_session_get_refresh_token(r, session);

src/proto/profile.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,25 @@ const char *oidc_proto_profile_token_endpoint_auth_aud(oidc_provider_t *provider
5353
return oidc_cfg_provider_token_endpoint_url_get(provider);
5454
}
5555

56+
/*
57+
* returns the "aud" claim to insert into the JWT used for client
58+
* authentication towards the revocation endpoint using private_key_jwt/client_secret_jwt
59+
*/
60+
const char *oidc_proto_profile_revocation_endpoint_auth_aud(oidc_provider_t *provider, const char *val) {
61+
if (oidc_cfg_provider_profile_get(provider) == OIDC_PROFILE_FAPI20) {
62+
return oidc_cfg_provider_issuer_get(provider);
63+
}
64+
const char *aud = oidc_cfg_provider_revocation_endpoint_url_get(provider);
65+
if (val != NULL) {
66+
if (_oidc_strcmp(val, "token") == 0) {
67+
aud = oidc_cfg_provider_token_endpoint_url_get(provider);
68+
} else {
69+
aud = val;
70+
}
71+
}
72+
return aud;
73+
}
74+
5675
/*
5776
* returns the method to be used when sending the authorization request to the Provider
5877
*/

src/proto/proto.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ typedef json_t oidc_proto_state_t;
124124
// profile.c
125125
oidc_auth_request_method_t oidc_proto_profile_auth_request_method_get(oidc_provider_t *provider);
126126
const char *oidc_proto_profile_token_endpoint_auth_aud(oidc_provider_t *provider);
127+
const char *oidc_proto_profile_revocation_endpoint_auth_aud(oidc_provider_t *provider, const char *val);
127128
const apr_array_header_t *oidc_proto_profile_id_token_aud_values_get(apr_pool_t *pool, oidc_provider_t *provider);
128129
const oidc_proto_pkce_t *oidc_proto_profile_pkce_get(oidc_provider_t *provider);
129130
oidc_dpop_mode_t oidc_proto_profile_dpop_mode_get(oidc_provider_t *provider);

0 commit comments

Comments
 (0)