mod_client_management: Include client software version number in listing
authorKim Alvefur <zash@zash.se>
Sat, 03 Jun 2023 19:21:39 +0200
changeset 5520 f25df3af02c1
parent 5519 f5931ce9b6ca
child 5521 a08abbd1045d
mod_client_management: Include client software version number in listing Should you ever wish to revoke a client by version number, e.g. for security reasons affecting certain versions, then it would be good to at the very least see which version is used. Also includes the OAuth2 software ID, an optional unique identifier that should be the same for all installations of a particular software.
mod_client_management/mod_client_management.lua
--- a/mod_client_management/mod_client_management.lua	Fri Jun 02 11:28:04 2023 +0200
+++ b/mod_client_management/mod_client_management.lua	Sat Jun 03 19:21:39 2023 +0200
@@ -35,6 +35,8 @@
 	if not (sasl_agent or token_agent) then return; end
 	return {
 		software = sasl_agent and sasl_agent.software or token_agent and token_agent.name or nil;
+		software_id = token_agent and token_agent.id or nil;
+		software_version = token_agent and token_agent.version or nil;
 		uri = token_agent and token_agent.uri or nil;
 		device = sasl_agent and sasl_agent.device or nil;
 	};
@@ -348,7 +350,7 @@
 		local user_agent = st.stanza("user-agent");
 		if client.user_agent then
 			if client.user_agent.software then
-				user_agent:text_tag("software", client.user_agent.software);
+				user_agent:text_tag("software", client.user_agent.software, { id = client.user_agent.software_id; version = client.user_agent.software_version });
 			end
 			if client.user_agent.device then
 				user_agent:text_tag("device", client.user_agent.device);