Add device_id support to /login
Add a 'devices' table to the storage, as well as a 'device_id' column to refresh_tokens. Allow the client to pass a device_id, and initial_device_display_name, to /login. If login is successful, then register the device in the devices table if it wasn't known already. If no device_id was supplied, make one up. Associate the device_id with the access token and refresh token, so that we can get at it again later. Ensure that the device_id is copied from the refresh token to the access_token when the token is refreshed.
Showing
- synapse/handlers/auth.py 11 additions, 8 deletionssynapse/handlers/auth.py
- synapse/handlers/device.py 71 additions, 0 deletionssynapse/handlers/device.py
- synapse/rest/client/v1/login.py 36 additions, 3 deletionssynapse/rest/client/v1/login.py
- synapse/rest/client/v2_alpha/tokenrefresh.py 7 additions, 3 deletionssynapse/rest/client/v2_alpha/tokenrefresh.py
- synapse/server.py 5 additions, 0 deletionssynapse/server.py
- synapse/storage/__init__.py 3 additions, 0 deletionssynapse/storage/__init__.py
- synapse/storage/devices.py 77 additions, 0 deletionssynapse/storage/devices.py
- synapse/storage/registration.py 18 additions, 10 deletionssynapse/storage/registration.py
- synapse/storage/schema/delta/33/devices.sql 21 additions, 0 deletionssynapse/storage/schema/delta/33/devices.sql
- synapse/storage/schema/delta/33/refreshtoken_device.sql 16 additions, 0 deletionssynapse/storage/schema/delta/33/refreshtoken_device.sql
- tests/handlers/test_device.py 75 additions, 0 deletionstests/handlers/test_device.py
- tests/storage/test_registration.py 14 additions, 7 deletionstests/storage/test_registration.py
Loading
Please register or sign in to comment