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.
--- 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";