Software / code / prosody
Comparison
plugins/mod_tokenauth.lua @ 12743:19113f232423
mod_tokenauth: Remove expired tokens from storage
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 06 Oct 2022 16:00:39 +0100 |
| parent | 12742:126aefd2c4c6 |
| child | 12772:daa654dbd8de |
comparison
equal
deleted
inserted
replaced
| 12742:126aefd2c4c6 | 12743:19113f232423 |
|---|---|
| 63 end | 63 end |
| 64 return nil, "not-authorized"; | 64 return nil, "not-authorized"; |
| 65 end | 65 end |
| 66 | 66 |
| 67 if token_info.expires and token_info.expires < os.time() then | 67 if token_info.expires and token_info.expires < os.time() then |
| 68 token_store:set(token_user, token_id, nil); | |
| 68 return nil, "not-authorized"; | 69 return nil, "not-authorized"; |
| 69 end | 70 end |
| 70 | 71 |
| 71 local account_info = usermanager.get_account_info(token_user, module.host); | 72 local account_info = usermanager.get_account_info(token_user, module.host); |
| 72 local password_updated_at = account_info and account_info.password_updated; | 73 local password_updated_at = account_info and account_info.password_updated; |
| 73 if password_updated_at and password_updated_at > token_info.created then | 74 if password_updated_at and password_updated_at > token_info.created then |
| 75 token_store:set(token_user, token_id, nil); | |
| 74 return nil, "not-authorized"; | 76 return nil, "not-authorized"; |
| 75 end | 77 end |
| 76 | 78 |
| 77 return token_info | 79 return token_info |
| 78 end | 80 end |