Open johakoch opened 2 years ago
Do we need to store local data in Couper for this? E.g. a map of tokens and last check? Or a list of revoked tokens?
Do we need to store local data in Couper for this? E.g. a map of tokens and last check? Or a list of revoked tokens?
In my proposal, in introspection_mode
"interval"
, the response to the introspection request (containing the active
property) is cached for a specified ttl (introspection_interval
).
The cache key could be e.g. the token itself, or a combination of iss
and jti
(string identifier for the token) if available.
Additionally, revoked tokens (or, again, some identifier) could be stored, to further reduce traffic.
If token is JWT:
exp
or other claims)
active
property"active": true/false
)exp
is known: maximum exp - unixtime()
)exp
is known and (either nbf
is unknown or unixtime() > nbf
):exp - unixtime()
(active
state will not change, and after expiry the token is invalid anyway)In this case, it would be sufficient to cache only the introspection response's active
property.
If token is opaque:
active
property and various claims properties)"active": true/false
)exp
: maximum exp - unixtime()
)In this case, the whole introspection response has to be cached.
Alternative configuration:
jwt "..." {
# ...
introspection {
endpoint = "..." # the introspection endpoint at the authorization server
backend = "..." # or backend {}; for introspection request
ttl = "..." # duration; positive value: cache introspection response, otherwise do not cache
}
}
Should this be a beta feature (beta_introspection
block)?
Is attribute name endpoint
ok? Or should it be introspection_endpoint
(parallel to token_endpoint
in oauth, but maybe redundant here)?
Token introspection is offered by e.g.
Use cases:
This could be achieved by making the JWT validator call the token introspection endpoint at the authorization server.
OAuth2 Token Introspection: RFC 7662
Proposed new attributes for
jwt
block (or for a nestedintrospection
block):There are two
introspection_mode
s:"always"
: validator introspects the token each time it is validated"interval"
: validator uses a cached introspection response OR introspects the token and caches the response for value ofintrospection_interval
.