# HG changeset patch # User Kim Alvefur # Date 1699572377 -3600 # Node ID 8afa0fb8a73e2dd4c4bab0fc0067827b313a91a0 # Parent 6696075e26e2af4a4d1dfe1e95fc409660433812 mod_client_management: Report on longest lived token when grant does not expire E.g. for mod_http_oauth2 where by default the grant itself is unlimited, while refresh tokens are issued with one week lifetime, but are renewed with each use. diff -r 6696075e26e2 -r 8afa0fb8a73e mod_client_management/mod_client_management.lua --- a/mod_client_management/mod_client_management.lua Tue Nov 07 11:28:46 2023 +0000 +++ b/mod_client_management/mod_client_management.lua Fri Nov 10 00:26:17 2023 +0100 @@ -471,10 +471,24 @@ }; { title = "Expires"; - key = "expires"; + key = "active"; width = date_or_time_width; align = "right"; - mapper = date_or_time; + mapper = function(active, client) + local grant = active and active.grant; + local expires = client and client.expires; + local tokens = grant and grant.tokens; + if expires or not tokens then + return date_or_time(expires); + end + + for _, token in pairs(tokens) do + if token.expires and (not expires or token.expires > expires) then + expires = token.expires; + end + end + return date_or_time(expires); + end; }; { title = "Authentication";