Skip to content

Commit

Permalink
Merge pull request #47 from codemation/improvement-cookie-security-an…
Browse files Browse the repository at this point in the history
…d-jwt-token-keys

Fix - Corrected Token Cleanup
  • Loading branch information
codemation authored Nov 29, 2021
2 parents 803e921 + 5a2962d commit fdea467
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions easyauth/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ async def global_store_update(action, store, key, value):
#trigger all registered functions within
#clients namespace
client_methods = manager['clients']
log.warning(f"triggering global_store_update for {client_methods}")
for method in client_methods:
if method == 'get_store_data':
continue
Expand All @@ -62,8 +61,7 @@ async def global_token_cleanup():
for method in client_methods:
if not 'token_cleanup' in method:
continue
result = await client_methods[method]()
log.debug(f"global_token_cleanup: cleaned {len(result)} expired tokens")
await client_methods[method]()
break

# start scheduler in background
Expand Down
5 changes: 3 additions & 2 deletions easyauth/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,12 +558,13 @@ async def token_cleanup(self):
all_tokens = await Tokens.all()
revoked_tokens = [
{
token.token_id: await self.revoke_token(token.token_id)
token.token_id: asyncio.create_task(self.revoke_token(token.token_id))
} for token in all_tokens
if datetime.datetime.now() > datetime.datetime.fromisoformat(token.expiration)
]

return revoked_tokens
self.log.warning(f"token_cleanup cleared {len(revoked_tokens)} expired tokens")
return f"finished cleaning {len(revoked_tokens)} expired tokens"


async def issue_token(self, permissions, minutes=60, hours=0, days=0):
Expand Down

0 comments on commit fdea467

Please sign in to comment.