Skip to content

Commit ef50efe

Browse files
committed
Document Synapse integration with the stable feature
1 parent c4e811a commit ef50efe

File tree

1 file changed

+34
-48
lines changed

1 file changed

+34
-48
lines changed

docs/setup/homeserver.md

Lines changed: 34 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,46 @@
11
# Homeserver configuration
22

33
The `matrix-authentication-service` is designed to be run alongside a Matrix homeserver.
4-
It currently only supports [Synapse](https://github.com/element-hq/synapse) through the experimental OAuth delegation feature.
4+
It currently only supports [Synapse](https://github.com/element-hq/synapse) version 1.136.0 or later.
55
The authentication service needs to be able to call the Synapse admin API to provision users through a shared secret, and Synapse needs to be able to call the service to verify access tokens using the OAuth 2.0 token introspection endpoint.
66

7-
## Provision a client for the Homeserver to use
8-
9-
In the [`clients`](../reference/configuration.md#clients) section of the configuration file, add a new client with the following properties:
10-
11-
- `client_id`: a unique identifier for the client. It must be a valid [ULID](https://github.com/ulid/spec), and it happens that `0000000000000000000SYNAPSE` is a valid ULID.
12-
- `client_auth_method`: set to `client_secret_basic`. Other methods are possible, but this is the easiest to set up.
13-
- `client_secret`: a shared secret used for the homeserver to authenticate
14-
15-
```yaml
16-
clients:
17-
- client_id: 0000000000000000000SYNAPSE
18-
client_auth_method: client_secret_basic
19-
client_secret: "SomeRandomSecret"
20-
```
21-
22-
**Don't forget to sync the configuration file** with the database after adding the client, using the [`config sync`](../reference/cli/config.md#config-sync---prune---dry-run) command.
23-
247
## Configure the connection to the homeserver
258

269
In the [`matrix`](../reference/configuration.md#matrix) section of the configuration file, add the following properties:
2710

11+
- `kind`: the type of homeserver to connect to, currently only `synapse` is supported
2812
- `homeserver`: corresponds to the `server_name` in the Synapse configuration file
29-
- `secret`: a shared secret the service will use to call the homeserver admin API
13+
- `secret`: a shared secret the service will use to call the homeserver MAS API
3014
- `endpoint`: the URL to which the homeserver is accessible from the service
3115

3216
```yaml
3317
matrix:
34-
homeserver: localhost:8008
35-
secret: "AnotherRandomSecret"
18+
kind: synapse
19+
homeserver: example.com
3620
endpoint: "http://localhost:8008"
21+
secret: "AVeryRandomSecretPleaseUseSomethingSecure"
22+
# Alternatively, using a file:
23+
#secret_path: /path/to/secret.txt
3724
```
3825

3926
## Configure the homeserver to delegate authentication to the service
4027

41-
Set up the delegated authentication feature in the Synapse configuration in the `experimental_features` section:
28+
Set up the delegated authentication feature **in the Synapse configuration** in the `matrix_authentication_service` section:
4229

4330
```yaml
44-
experimental_features:
45-
msc3861:
46-
enabled: true
47-
48-
# Synapse will call `{issuer}/.well-known/openid-configuration` to get the OIDC configuration
49-
issuer: http://localhost:8080/
50-
51-
# Matches the `client_id` in the auth service config
52-
client_id: 0000000000000000000SYNAPSE
53-
# Matches the `client_auth_method` in the auth service config
54-
client_auth_method: client_secret_basic
55-
# Matches the `client_secret` in the auth service config
56-
client_secret: "SomeRandomSecret"
57-
58-
# Matches the `matrix.secret` in the auth service config
59-
admin_token: "AnotherRandomSecret"
60-
61-
# URL to advertise to clients where users can self-manage their account
62-
# Defaults to the URL advertised by MAS, e.g. `https://{public_mas_domain}/account/`
63-
#account_management_url: "http://localhost:8080/account/"
64-
65-
# URL which Synapse will use to introspect access tokens
66-
# Defaults to the URL advertised by MAS, e.g. `https://{public_mas_domain}/oauth2/introspect`
67-
# This is useful to override if Synapse has a way to call the auth service's
68-
# introspection endpoint directly, skipping intermediate reverse proxies
69-
#introspection_endpoint: "http://localhost:8080/oauth2/introspect"
31+
matrix_authentication_service:
32+
enabled: true
33+
endpoint: http://localhost:8080/
34+
secret: "AVeryRandomSecretPleaseUseSomethingSecure"
35+
# Alternatively, using a file:
36+
#secret_file: /path/to/secret.txt
7037
```
7138

39+
The `endpoint` property should be set to the URL of the authentication service.
40+
This can be an internal URL, to avoid unnecessary round-trips.
41+
42+
The `secret` property must match in both the Synapse configuration and the Matrix Authentication Service configuration.
43+
7244
## Set up the compatibility layer
7345

7446
The service exposes a compatibility layer to allow legacy clients to authenticate using the service.
@@ -81,3 +53,17 @@ The following Matrix Client-Server API endpoints need to be handled by the authe
8153
- [`/_matrix/client/*/refresh`](https://spec.matrix.org/latest/client-server-api/#post_matrixclientv3refresh)
8254

8355
See the [reverse proxy configuration](./reverse-proxy.md) guide for more information.
56+
57+
58+
## Migrating from the experimental MSC3861 feature
59+
60+
If you are migrating from the experimental MSC3861 feature in Synapse, you will need to migrate the `experimental_features.msc3861` section of the Synapse configuration to the `matrix_authentication_service` section.
61+
62+
To do so, you need to:
63+
64+
- Remove the `experimental_features.msc3861` section from the Synapse configuration
65+
- Add the `matrix_authentication_service` section to the Synapse configuration with:
66+
- `enabled: true`
67+
- `endpoint` set to the URL of the authentication service
68+
- `secret` set to the same secret as the `admin_token` that was set in the `msc3861` section
69+
- Optionally, remove the client provisionned for Synapse in the `clients` section of the MAS configuration

0 commit comments

Comments
 (0)