Mercurial > prosody-modules
comparison mod_client_management/mod_client_management.lua @ 5694:8afa0fb8a73e
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 10 Nov 2023 00:26:17 +0100 |
parents | c69320fc438b |
children | 3730992d0c7c |
comparison
equal
deleted
inserted
replaced
5693:6696075e26e2 | 5694:8afa0fb8a73e |
---|---|
469 align = "right"; | 469 align = "right"; |
470 mapper = date_or_time; | 470 mapper = date_or_time; |
471 }; | 471 }; |
472 { | 472 { |
473 title = "Expires"; | 473 title = "Expires"; |
474 key = "expires"; | 474 key = "active"; |
475 width = date_or_time_width; | 475 width = date_or_time_width; |
476 align = "right"; | 476 align = "right"; |
477 mapper = date_or_time; | 477 mapper = function(active, client) |
478 local grant = active and active.grant; | |
479 local expires = client and client.expires; | |
480 local tokens = grant and grant.tokens; | |
481 if expires or not tokens then | |
482 return date_or_time(expires); | |
483 end | |
484 | |
485 for _, token in pairs(tokens) do | |
486 if token.expires and (not expires or token.expires > expires) then | |
487 expires = token.expires; | |
488 end | |
489 end | |
490 return date_or_time(expires); | |
491 end; | |
478 }; | 492 }; |
479 { | 493 { |
480 title = "Authentication"; | 494 title = "Authentication"; |
481 key = "active"; | 495 key = "active"; |
482 width = "2p"; | 496 width = "2p"; |