-
-
Notifications
You must be signed in to change notification settings - Fork 669
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
Appservice login #2936
Appservice login #2936
Conversation
b534c90
to
3cd0920
Compare
Codecov ReportBase: 40.30% // Head: 40.47% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2936 +/- ##
==========================================
+ Coverage 40.30% 40.47% +0.17%
==========================================
Files 519 520 +1
Lines 56436 56457 +21
==========================================
+ Hits 22745 22851 +106
+ Misses 30968 30896 -72
+ Partials 2723 2710 -13
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
c52f212
to
23fa52f
Compare
Signed-off-by: Sijmen <me@sijman.nl> Signed-off-by: Sijmen Schoon <me@sijman.nl>
Signed-off-by: Sijmen <me@sijman.nl> Signed-off-by: Sijmen Schoon <me@sijman.nl>
Signed-off-by: Sijmen <me@sijman.nl> Signed-off-by: Sijmen Schoon <me@sijman.nl>
Signed-off-by: Sijmen <me@sijman.nl> Signed-off-by: Sijmen Schoon <me@sijman.nl>
Signed-off-by: Sijmen <me@sijman.nl> Signed-off-by: Sijmen Schoon <me@sijman.nl>
Signed-off-by: Sijmen Schoon <me@sijman.nl>
23fa52f
to
11e16a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks for adding tests as well :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise this looks great, thanks!
internal/validate_test.go
Outdated
// Access token is correct, acting as user_id that matches but is invalid | ||
asID, resp = ValidateApplicationService(&fakeConfig.ClientAPI, "@_appservice_bob::", fakeApplicationService.ASToken) | ||
if resp == nil || asID == fakeApplicationService.ID { | ||
t.Errorf("user_id should not have been valid: @_appservice_bob::") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good tests overall, but please make them table-driven as it's significantly easier to see the inputs / expected outputs https://dave.cheney.net/2019/05/07/prefer-table-driven-tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this?
JSON: flows{ | ||
Flows: []flow{ | ||
{Type: authtypes.LoginTypePassword}, | ||
{Type: authtypes.LoginTypeApplicationService}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only true if Dendrite has been configured with appservices surely.
Please fix the linter errors. |
Hey @vijfhoek, thanks for your work - I'm currently testing your PR on my dendrite instance with mautrix-signal and so far it works great! I rebased your PR on the current main branch: https://github.com/sebastian-de/dendrite/commits/appservice Feel free to use this tree, if you'd like to push again. |
It seems mautrix-signal has problems to connect, when encryption is enabled. This a log from mautrix-signal.service:
The dendrite logs don't reveal anything regarding that error. |
This was a configuration error in mautrix-signal - the bridge seems to mix things up, when shared secret auth is enabled. |
I was trying this branch with encryption support but it seems to fails for me using The bot returns this when trying to do a request to {
"errcode": "M_UNKNOWN_TOKEN",
"error": "Unknown token"
} and it fails retrieving encryption keys for the encrypted chat. Although it connects good to the Dendrite instance and it detects that the server supports appservice encryption. And in the configuration file of the Bot i need to change from https://github.com/mautrix/whatsapp/blob/master/example-config.yaml#L353 |
This PR is at risk of being closed. Unfortunately the lint errors haven't been fixed yet, and now there's a lot of merge conflicts. |
I haven't had too much time lately, sorry. The merge conflicts seem to be fairly simple to solve at first sight though |
Hey @vijfhoek - hope you're doing good - I took the liberty to rebase your branch and opened a new PR, if you'd prefer to have it in your repo, let me know and I'll add a PR to that instead. Thanks for your work and cheers ❤️ |
Closing because this one's superseded by #3078 |
Rebase of #2936 as @vijfhoek wrote he got no time to work on this, and I kind of needed it for my experiments. I checked the tests, and it is working with my example code (i.e. impersonating, registering, creating channel, invite people, write messages). I'm not a huge `go` pro, and still learning, but I tried to fix and/or integrate the changes as best as possible with the current `main` branch changes. If there is anything left, let me know and I'll try to figure it out. Signed-off-by: `Kuhn Christopher <kuhnchris+git@kuhnchris.eu>` --------- Signed-off-by: Sijmen <me@sijman.nl> Signed-off-by: Sijmen Schoon <me@sijman.nl> Co-authored-by: Sijmen Schoon <me@sijman.nl> Co-authored-by: Sijmen Schoon <me@vijf.life> Co-authored-by: Till <2353100+S7evinK@users.noreply.github.com>
Fixes #2723
This is my first contribution to this code base, so I hope I did everything correctly :)
I did move
validateApplicationService
(nowValidateApplicationService
) fromrouting
tointernal
to be able to reuse it - is this the right place for it?Pull Request Checklist
Signed-off-by:
Sijmen Schoon <me@sijman.nl>