Track refresh token last usage information (#16408)

* Extend refresh_token to support last_used_at and last_used_by

* Address code review comment

* Remove unused code

* Add it to websocket response

* Fix typing
This commit is contained in:
Jason Hu 2018-09-12 04:24:16 -07:00 committed by Paulus Schoutsen
parent 453cbb7c60
commit ff78a5b04b
6 changed files with 65 additions and 10 deletions

View file

@ -55,13 +55,16 @@ class RefreshToken:
jwt_key = attr.ib(type=str,
default=attr.Factory(lambda: generate_secret(64)))
last_used_at = attr.ib(type=Optional[datetime], default=None)
last_used_ip = attr.ib(type=Optional[str], default=None)
@attr.s(slots=True)
class Credentials:
"""Credentials for a user on an auth provider."""
auth_provider_type = attr.ib(type=str)
auth_provider_id = attr.ib(type=str) # type: Optional[str]
auth_provider_id = attr.ib(type=Optional[str])
# Allow the auth provider to store data to represent their auth.
data = attr.ib(type=dict)