equal
deleted
inserted
replaced
65 end |
65 end |
66 if not tried_current_token and not invalidate then |
66 if not tried_current_token and not invalidate then |
67 -- The new token is becoming the current token |
67 -- The new token is becoming the current token |
68 token_store:set_keys(username, { |
68 token_store:set_keys(username, { |
69 [key] = token_store.remove; |
69 [key] = token_store.remove; |
70 [key:sub(1, -4).."-cur"] = token; |
70 [key:sub(1, -5).."-cur"] = token; |
71 }); |
71 }); |
72 end |
72 end |
73 local rotation_needed; |
73 local rotation_needed; |
74 if invalidate then |
74 if invalidate then |
75 token_store:set(username, key, nil); |
75 token_store:set(username, key, nil); |
82 end |
82 end |
83 if not tried_current_token then |
83 if not tried_current_token then |
84 log("debug", "Trying next token..."); |
84 log("debug", "Trying next token..."); |
85 -- Try again with the current token instead |
85 -- Try again with the current token instead |
86 tried_current_token = true; |
86 tried_current_token = true; |
87 key = key:sub(1, -4).."-cur"; |
87 key = key:sub(1, -5).."-cur"; |
88 else |
88 else |
89 log("debug", "No matching %s token found for %s/%s", mechanism, username, key); |
89 log("debug", "No matching %s token found for %s/%s", mechanism, username, key); |
90 return nil; |
90 return nil; |
91 end |
91 end |
92 until false; |
92 until false; |