You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Bearer auth token for `notify_on_registration_uri` call (optional)
65
-
notification_access_token: 'my$3cr37'
52
+
oauth:
53
+
# see OAuthConfig section
66
54
```
67
55
It is recommended to have `require_expiry` set to `true` (default). As for `allow_registration`, it depends on usecase: If you only want to be able to log in *existing* users, leave it at `false` (default). If nonexistant users should be simply registered upon hitting the login endpoint, set it to `true`.
|`registration_enabled`| Bool (defaults to `false`) |
67
+
68
+
At least one of `jwt_validation` or `introspection_validation` must be defined.
69
+
70
+
`username_type` specifies the role of `identifier.user`:
71
+
-`'fq_uid'` — must be fully qualified username, e.g. `@alice:example.test`
72
+
-`'localpart'` — must be localpart, e.g. `alice`
73
+
-`'user_id'` — could be localpart or fully qualified username
74
+
-`null` — the username is ignored, it will be source from the token or introspection response
75
+
76
+
`notify_on_registration_url` will be called when a new user is registered with this body:
77
+
```json
78
+
{
79
+
"localpart": "alice",
80
+
"fully_qualified_uid": "@alice:example.test",
81
+
"displayname": "Alice",
82
+
},
83
+
```
84
+
85
+
`expose_metadata_resource` must be an object with `name` field. The object will be exposed at `/_famedly/login/{expose_metadata_resource.name}`.
86
+
87
+
`jwt_validation` and `introspection_validation` contain a bunch of `*_path` optional fields. Each of these, if specified will be used to source either localpart, user id, or fully qualified user id from jwt claims and introspection response. They values are going to be compared for equality, if they differ, authentication would fail. Be careful with these, as it is possible to configure in such a way that authentication would always fail, or, if `username_type` is `null`, no user id data can be sourced, thus also leading to failure.
88
+
89
+
90
+
### JwtValidationConfig
91
+
[RFC 7519 - JSON Web Token (JWT)](https://datatracker.ietf.org/doc/html/rfc7519)
|`validator`|[`Validator`](#Validator) (defaults to [`Exist`](#Exist)) |
95
+
|`require_expiry`| Bool (defaults to `false`) |
96
+
|`localpart_path`|[`Path`](#Path) (optional) |
97
+
|`user_id_path`|[`Path`](#Path) (optional) |
98
+
|`fq_uid_path`|[`Path`](#Path) (optional) |
99
+
|`displayname_path`|[`Path`](#Path) (optional) |
100
+
|`required_scopes`| Space separated string or a list of strings (optional) |
101
+
|`jwk_set`|[JWKSet](https://datatracker.ietf.org/doc/html/rfc7517#section-5) or [JWK](https://datatracker.ietf.org/doc/html/rfc7517#section-4) (optional) |
|`validator`|[`Validator`](#Validator) (optional, defaults to [`Exist`](#Exist)) |
264
+
265
+
#### Examples
266
+
```yaml
267
+
['in', ['foo', 'bar'], ['equal', 3]]
268
+
```
269
+
270
+
### ListAllOf:
271
+
*TODO*
272
+
273
+
### ListAnyOf:
274
+
*TODO*
275
+
276
+
#### Examples
277
+
-`'foo'` is an existing path in `{'foo': 3}`, resulting in value `3`
278
+
-`['foo']` is an existing path in `{'foo': 3}`, resulting in value `3`
279
+
-`['foo', 'bar']` is an existing path in `{'foo': {'bar': 3}}`, resulting in value `3`
280
+
69
281
## Usage
70
282
71
283
### JWT Authentication
@@ -110,38 +322,6 @@ Next, the client needs to use these tokens and construct a payload to the login
110
322
}
111
323
```
112
324
113
-
### Custom flow
114
-
115
-
This is similar to jwt flow except few additinal claims are checked:
116
-
- `name`claim must be present
117
-
- `urn:messaging:matrix:localpart`claim must be equal to user name
118
-
- `urn:messaging:matrix:mxid`claim must be valid mxid with localpart matching `urn:messaging:matrix:localpart` claim and domain name matching this homeserver domain
119
-
120
-
```jsonc
121
-
{
122
-
"type": "com.famedly.login.token.custom",
123
-
"identifier": {
124
-
"type": "m.id.user",
125
-
"user": "d2773fdb-91b5-4e77-9367-d4bd121afc48" // localpart, same as `urn:messaging:matrix:localpart` in JWT
Additionally, when a new user is registered, a POST json request is made with `{"token": <token>}` as its request body. The handler of the request must return any json due to some implementation details (synapse's `BaseHttpClient` poor interface)
144
-
145
325
## Testing
146
326
147
327
The tests uses twisted's testing framework trial, with the development
0 commit comments