diff options
author | Erik Johnston <erik@matrix.org> | 2018-11-28 11:41:40 +0000 |
---|---|---|
committer | Brendan Abolivier <babolivier@matrix.org> | 2019-02-13 20:54:34 +0000 |
commit | 7f9a087947e6d985eec52bb89c852acbee5b9e0e (patch) | |
tree | 88a879f17c7a6cbfd6df50afa0180204d8910c3e | |
parent | Merge pull request #4218 from matrix-org/travis/account-merging (diff) | |
download | synapse-7f9a087947e6d985eec52bb89c852acbee5b9e0e.tar.xz |
Change access tokens to be base64'ed 4 bytes
-rw-r--r-- | synapse/handlers/auth.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py index a958c45271..e868d18669 100644 --- a/synapse/handlers/auth.py +++ b/synapse/handlers/auth.py @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import base64 +import secrets import logging import unicodedata @@ -748,7 +750,9 @@ class AuthHandler(BaseHandler): @defer.inlineCallbacks def issue_access_token(self, user_id, device_id=None): - access_token = self.macaroon_gen.generate_access_token(user_id) + # access_token = self.macaroon_gen.generate_access_token(user_id) + access_token = base64.b64encode(secrets.token_bytes(8)) + yield self.store.add_access_token_to_user(user_id, access_token, device_id) defer.returnValue(access_token) |