Browse Source

FEAT: token util better logging for timeouts, verification

master
Aaron van Meerten 5 years ago
parent
commit
e439d065b7
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      resources/prosody-plugins/token/util.lib.lua

+ 6
- 1
resources/prosody-plugins/token/util.lib.lua View File

@@ -152,7 +152,10 @@ function Util:get_public_key(keyId)
152 152
             -- TODO: This check is racey. Not likely to be a problem, but we should
153 153
             --       still stick a mutex on content / code at some point.
154 154
             if code == nil then
155
-                http.destroy_request(request);
155
+                module:log("warn", "Timeout %s seconds fetching public key from: %s",http_timeout,keyurl);
156
+                if http.destroy_request then
157
+                    http.destroy_request(request);
158
+                end
156 159
                 done();
157 160
             end
158 161
         end
@@ -175,6 +178,7 @@ end
175 178
 -- @param 'iss' claim from the token to verify
176 179
 -- @return nil and error string or true for accepted claim
177 180
 function Util:verify_issuer(issClaim)
181
+    module:log("debug","verify_issuer claim: %s against accepted: %s",issClaim, self.acceptedIssuers);
178 182
     for i, iss in ipairs(self.acceptedIssuers) do
179 183
         if issClaim == iss then
180 184
             --claim matches an accepted issuer so return success
@@ -189,6 +193,7 @@ end
189 193
 -- @param 'aud' claim from the token to verify
190 194
 -- @return nil and error string or true for accepted claim
191 195
 function Util:verify_audience(audClaim)
196
+    module:log("debug","verify_audience claim: %s against accepted: %s",audClaim, self.acceptedAudiences);
192 197
     for i, aud in ipairs(self.acceptedAudiences) do
193 198
         if aud == '*' then
194 199
             --* indicates to accept any audience in the claims so return success

Loading…
Cancel
Save