Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to new module API #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidmehren
Copy link

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 anishihara@6c29f4d by @anishihara

Fixes #9

almightybob added a commit to almightybob/matrix-synapse-rest-password-provider that referenced this pull request Dec 20, 2021
@almightybob
Copy link

almightybob commented Dec 20, 2021

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
Copy link

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"

joshuaboniface added a commit to joshuaboniface/matrix-synapse-rest-password-provider that referenced this pull request May 25, 2023
This is required as the function was updated to take this explicit type,
rather than just the localpart, in matrix-org/synapse#15458 as part of
version 1.83.

This is stacked atop ma1uta#10 to ensure everything is updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Needs porting to the new Synapse v1.46+ module API
3 participants