Ver código fonte

feat(jwt): Adds some more logs around expiration.

factor2
damencho 8 meses atrás
pai
commit
a50d6dc0f4

+ 5
- 1
resources/prosody-plugins/luajwtjitsi.lib.lua Ver arquivo

@@ -226,7 +226,11 @@ function M.verify(token, expectedAlgo, key, acceptedIssuers, acceptedAudiences)
226 226
 
227 227
 
228 228
 	if body.exp and os.time() >= body.exp then
229
-		return nil, "Not acceptable by exp ("..tostring(os.time()-body.exp)..")"
229
+        local extra_msg = '';
230
+        if body.iat then
231
+            extra_msg = ", valid for:"..tostring(body.exp-body.iat).." sec";
232
+        end
233
+		return nil, "Not acceptable by exp ("..tostring(os.time()-body.exp).." sec since expired"..extra_msg..")"
230 234
 	end
231 235
 
232 236
 	if body.nbf and os.time() < body.nbf then

+ 4
- 2
resources/prosody-plugins/mod_auth_token.lua Ver arquivo

@@ -55,6 +55,7 @@ function init_session(event)
55 55
 
56 56
     -- in either case set auth_token in the session
57 57
     session.auth_token = token;
58
+    session.user_agent_header = request.headers['user_agent'];
58 59
 end
59 60
 
60 61
 module:hook_global("bosh-session", init_session);
@@ -101,8 +102,9 @@ function provider.get_sasl_handler(session)
101 102
         local res, error, reason = token_util:process_and_verify_token(session);
102 103
         if res == false then
103 104
             module:log("warn",
104
-                "Error verifying token err:%s, reason:%s tenant:%s room:%s",
105
-                    error, reason, session.jitsi_web_query_prefix, session.jitsi_web_query_room);
105
+                "Error verifying token err:%s, reason:%s tenant:%s room:%s user_agent:%s",
106
+                    error, reason, session.jitsi_web_query_prefix, session.jitsi_web_query_room,
107
+                    session.user_agent_header);
106 108
             session.auth_token = nil;
107 109
             measure_verify_fail(1);
108 110
             return res, error, reason;

Carregando…
Cancelar
Salvar