diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2019-07-12 17:26:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-12 17:26:02 +0100 |
commit | 5f158ec039e4753959aad9b8d288b3d8cb4959a1 (patch) | |
tree | 5365e3257124ee89e8ef0026ffc6dd5ef4b153fc /synapse/api/errors.py | |
parent | fix typo: backgroud -> background (diff) | |
download | synapse-5f158ec039e4753959aad9b8d288b3d8cb4959a1.tar.xz |
Implement access token expiry (#5660)
Record how long an access token is valid for, and raise a soft-logout once it expires.
Diffstat (limited to 'synapse/api/errors.py')
-rw-r--r-- | synapse/api/errors.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py index 41fd04cd54..a6e753c30c 100644 --- a/synapse/api/errors.py +++ b/synapse/api/errors.py @@ -245,8 +245,14 @@ class MissingClientTokenError(InvalidClientCredentialsError): class InvalidClientTokenError(InvalidClientCredentialsError): """Raised when we didn't understand the access token in a request""" - def __init__(self, msg="Unrecognised access token"): + def __init__(self, msg="Unrecognised access token", soft_logout=False): super().__init__(msg=msg, errcode="M_UNKNOWN_TOKEN") + self._soft_logout = soft_logout + + def error_dict(self): + d = super().error_dict() + d["soft_logout"] = self._soft_logout + return d class ResourceLimitError(SynapseError): |