11/*
2- Copyright 2024 New Vector Ltd.
2+ Copyright 2024-2025 New Vector Ltd.
33Copyright 2023 The Matrix.org Foundation C.I.C.
44
55SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
66Please see LICENSE files in the repository root for full details.
77*/
88
9- import { MatrixAuthenticationServiceContainer } from "@element-hq/element-web-playwright-common/lib/testcontainers" ;
10-
9+ import { MatrixAuthenticationServiceContainer } from "../../../testcontainers/mas.ts" ;
1110import { type Fixtures } from "../../../element-web-test.ts" ;
1211
1312export const masHomeserver : Fixtures = {
1413 mas : [
1514 async ( { _homeserver : homeserver , logger, network, postgres, mailpit } , use ) => {
16- const config = {
17- clients : [
18- {
19- client_id : "0000000000000000000SYNAPSE" ,
20- client_auth_method : "client_secret_basic" ,
21- client_secret : "SomeRandomSecret" ,
22- } ,
23- ] ,
24- matrix : {
25- homeserver : "localhost" ,
26- secret : "AnotherRandomSecret" ,
27- endpoint : "http://homeserver:8008" ,
28- } ,
29- } ;
15+ const secret = "AnotherRandomSecret" ;
3016
17+ const limits = { burst : 10 , per_second : 10 } ;
3118 const container = await new MatrixAuthenticationServiceContainer ( postgres )
3219 . withNetwork ( network )
3320 . withNetworkAliases ( "mas" )
3421 . withLogConsumer ( logger . getConsumer ( "mas" ) )
35- . withConfig ( config )
22+ . withConfig ( {
23+ matrix : {
24+ kind : "synapse" ,
25+ homeserver : "localhost" ,
26+ secret,
27+ endpoint : "http://homeserver:8008" ,
28+ } ,
29+ rate_limiting : {
30+ login : {
31+ per_ip : limits ,
32+ per_account : limits ,
33+ } ,
34+ registration : limits ,
35+ email_authentication : {
36+ per_ip : limits ,
37+ per_address : limits ,
38+ emails_per_session : limits ,
39+ attempt_per_session : limits ,
40+ } ,
41+ account_recovery : {
42+ per_ip : limits ,
43+ per_address : limits ,
44+ } ,
45+ } ,
46+ } )
3647 . start ( ) ;
3748
3849 homeserver . withConfig ( {
3950 enable_registration : undefined ,
4051 enable_registration_without_verification : undefined ,
4152 disable_msisdn_registration : undefined ,
4253 password_config : undefined ,
43- experimental_features : {
44- msc3861 : {
45- enabled : true ,
46- issuer : `http://mas:8080/` ,
47- introspection_endpoint : "http://mas:8080/oauth2/introspect" ,
48- client_id : config . clients [ 0 ] . client_id ,
49- client_auth_method : config . clients [ 0 ] . client_auth_method ,
50- client_secret : config . clients [ 0 ] . client_secret ,
51- admin_token : config . matrix . secret ,
52- } ,
54+ matrix_authentication_service : {
55+ enabled : true ,
56+ endpoint : "http://mas:8080/" ,
57+ secret,
5358 } ,
5459 } ) ;
5560
@@ -59,28 +64,6 @@ export const masHomeserver: Fixtures = {
5964 { scope : "worker" } ,
6065 ] ,
6166
62- config : async ( { homeserver, context, mas } , use ) => {
63- const issuer = `${ mas . baseUrl } /` ;
64- const wellKnown = {
65- "m.homeserver" : {
66- base_url : homeserver . baseUrl ,
67- } ,
68- "org.matrix.msc2965.authentication" : {
69- issuer,
70- account : `${ issuer } account` ,
71- } ,
72- } ;
73-
74- // Ensure org.matrix.msc2965.authentication is in well-known
75- await context . route ( "https://localhost/.well-known/matrix/client" , async ( route ) => {
76- await route . fulfill ( { json : wellKnown } ) ;
77- } ) ;
78-
79- await use ( {
80- default_server_config : wellKnown ,
81- } ) ;
82- } ,
83-
8467 context : async ( { homeserverType, context } , use , testInfo ) => {
8568 testInfo . skip ( homeserverType !== "synapse" , "does not yet support MAS" ) ;
8669 await use ( context ) ;
0 commit comments