ma1uta / matrix-synapse-rest-password-provider

Password Provider for Synapse fetching data from a REST endpoint
GNU Affero General Public License v3.0
27 stars 17 forks source link

Port to new module API #10

Open davidmehren opened 2 years ago

davidmehren commented 2 years ago

This ports the auth provider to the new module API of Synapse 1.46+.

Docs: https://matrix-org.github.io/synapse/latest/modules/password_auth_provider_callbacks.html

Based on https://github.com/anishihara/matrix-synapse-rest-password-provider/commit/6c29f4deddab589bf9f6b4d37dd4b207e5a55c7b by @anishihara

Fixes https://github.com/ma1uta/matrix-synapse-rest-password-provider/issues/9

almightybob commented 2 years ago

I'm getting following error using this in a ansible deploy: ` Dec 20 20:56:00 rc21s1404 matrix-synapse[655791]: 2021-12-20 19:56:00,875 - root - 349 - WARNING - main - STARTING SERVER

Dec 20 20:56:00 rc21s1404 matrix-synapse[655791]: 2021-12-20 19:56:00,875 - root - 350 - WARNING - main - Server /usr/local/lib/python3.8/site-packages/synapse/app/homeserver.py version 1.49.0

Dec 20 20:56:00 rc21s1404 matrix-postgres[651253]: 2021-12-20 19:56:00.905 UTC [67] WARNING: there is already a transaction in progress

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: 2021-12-20 19:56:01,019 - synapse.handlers.auth - 1924 - ERROR - sentinel - Error while initializing <class 'rest_auth_provider.RestAuthProvider'>: init() got an unexpected keyword argument 'account_handler'

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: 2021-12-20 19:56:01,020 - synapse.app._base - 242 - CRITICAL - sentinel - Error during startup

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: Traceback (most recent call last): Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: File "/usr/local/lib/python3.8/site-packages/synapse/app/_base.py", line 227, in wrapper

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: await cb(*args, **kwargs) Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: File "/usr/local/lib/python3.8/site-packages/synapse/app/homeserver.py", line 396, in start

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: await _base.start(hs) Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: File "/usr/local/lib/python3.8/site-packages/synapse/app/_base.py", line 443, in start

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: load_legacy_password_auth_providers(hs) Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: File "/usr/local/lib/python3.8/site-packages/synapse/handlers/auth.py", line 1911, in load_legacy_password_auth_providers

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: load_single_legacy_password_auth_provider( Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: File "/usr/local/lib/python3.8/site-packages/synapse/handlers/auth.py", line 1922, in load_single_legacy_password_auth_provider

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: provider = module(config=config, account_handler=api) Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: TypeError: init() got an unexpected keyword argument 'account_handler' `

anishihara commented 2 years ago

I'm getting following error using this in a ansible deploy: ` Dec 20 20:56:00 rc21s1404 matrix-synapse[655791]: 2021-12-20 19:56:00,875 - root - 349 - WARNING - main - STARTING SERVER

Dec 20 20:56:00 rc21s1404 matrix-synapse[655791]: 2021-12-20 19:56:00,875 - root - 350 - WARNING - main - Server /usr/local/lib/python3.8/site-packages/synapse/app/homeserver.py version 1.49.0

Dec 20 20:56:00 rc21s1404 matrix-postgres[651253]: 2021-12-20 19:56:00.905 UTC [67] WARNING: there is already a transaction in progress

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: 2021-12-20 19:56:01,019 - synapse.handlers.auth - 1924 - ERROR - sentinel - Error while initializing <class 'rest_auth_provider.RestAuthProvider'>: init() got an unexpected keyword argument 'account_handler'

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: 2021-12-20 19:56:01,020 - synapse.app._base - 242 - CRITICAL - sentinel - Error during startup

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: Traceback (most recent call last): Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: File "/usr/local/lib/python3.8/site-packages/synapse/app/_base.py", line 227, in wrapper

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: await cb(*args, **kwargs) Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: File "/usr/local/lib/python3.8/site-packages/synapse/app/homeserver.py", line 396, in start

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: await _base.start(hs) Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: File "/usr/local/lib/python3.8/site-packages/synapse/app/_base.py", line 443, in start

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: load_legacy_password_auth_providers(hs) Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: File "/usr/local/lib/python3.8/site-packages/synapse/handlers/auth.py", line 1911, in load_legacy_password_auth_providers

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: load_single_legacy_password_auth_provider( Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: File "/usr/local/lib/python3.8/site-packages/synapse/handlers/auth.py", line 1922, in load_single_legacy_password_auth_provider

Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: provider = module(config=config, account_handler=api) Dec 20 20:56:01 rc21s1404 matrix-synapse[655791]: TypeError: init() got an unexpected keyword argument 'account_handler' `

Which synapse version are you using? Did you remove the legacy password_providers from the yaml file and added the new modules way?

modules:
  - module: "rest_auth_provider.RestAuthProvider"
    config:
      endpoint: "http://change.me.example.com:12345"