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

feat: add matrix-auth integration #15

Merged
merged 13 commits into from
Oct 14, 2024
Merged

Conversation

amandahla
Copy link
Collaborator

@amandahla amandahla commented Oct 7, 2024

Applicable spec:

Overview

Add matrix-auth integration that allows integrate Maubot with Synapse.

Rationale

The first step to install a bot is create a client.

A client requires that the homeserver is configured in the Maubot configuration file.

Once is there, the user will run an action "register-client-account" that will create a user and return an access token and a device id.

See here for the entire flow:
https://docs.mau.fi/maubot/usage/basic.html#creating-clients

Extra:

  • If the integrations PostgreSQL and/or matrix-auth relation data are not found, the charm is blocked and if the service is running, is stopped. Thanks @javierdelapuente for spotting this
  • Integration test will be added once Synapse provides the matrix-auth endpoint.

Juju Events Changes

_on_matrix_auth_request_processed

Module Changes

Library Changes

Matrix auth library.

Checklist

No CH available yet.

@amandahla amandahla requested a review from a team as a code owner October 7, 2024 18:57
Copy link

@cbartz cbartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I have some comments/questions ;-)

lib/charms/synapse/v0/matrix_auth.py Show resolved Hide resolved
tests/unit/test_charm.py Outdated Show resolved Hide resolved
tests/unit/test_charm.py Outdated Show resolved Hide resolved
tests/unit/test_charm.py Outdated Show resolved Hide resolved
Copy link

@javierdelapuente javierdelapuente left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments/questions

src/charm.py Outdated Show resolved Hide resolved
src/charm.py Show resolved Hide resolved
Copy link

@jdkandersson jdkandersson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't finished the review. I have left some comments that may be applicable in the rest of the code. Let's discuss these initially, potentially update the rest of the code and then we can look at the rest

lib/charms/synapse/v0/matrix_auth.py Show resolved Hide resolved
lib/charms/synapse/v0/matrix_auth.py Show resolved Hide resolved
lib/charms/synapse/v0/matrix_auth.py Show resolved Hide resolved
lib/charms/synapse/v0/matrix_auth.py Show resolved Hide resolved
lib/charms/synapse/v0/matrix_auth.py Show resolved Hide resolved
lib/charms/synapse/v0/matrix_auth.py Show resolved Hide resolved
lib/charms/synapse/v0/matrix_auth.py Show resolved Hide resolved
lib/charms/synapse/v0/matrix_auth.py Show resolved Hide resolved
lib/charms/synapse/v0/matrix_auth.py Show resolved Hide resolved
lib/charms/synapse/v0/matrix_auth.py Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
src/charm.py Show resolved Hide resolved
tests/unit/test_charm.py Show resolved Hide resolved
Copy link

Test coverage for 52da8a6

Name           Stmts   Miss Branch BrPart  Cover   Missing
----------------------------------------------------------
src/charm.py     130     11     22      6    89%   129-131, 149, 153, 175, 179, 197, 224, 229, 251
----------------------------------------------------------
TOTAL            130     11     22      6    89%

Static code analysis report

Run started:2024-10-11 16:28:22.123919

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 545
  Total lines skipped (#nosec): 0
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

Copy link

@Thanhphan1147 Thanhphan1147 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some minor comments

@amandahla amandahla merged commit d495f50 into main Oct 14, 2024
17 checks passed
@amandahla amandahla deleted the ISD-2411-matrix-integration branch October 14, 2024 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants