Skip to content

Commit 959e383

Browse files
committed
fixup! Introduce compat login policy
1 parent 1ce2c39 commit 959e383

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed

crates/handlers/src/test_utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ pub(crate) async fn policy_factory(
8282
register: "register/violation".to_owned(),
8383
client_registration: "client_registration/violation".to_owned(),
8484
authorization_grant: "authorization_grant/violation".to_owned(),
85+
compat_login: "compat_login/violation".to_owned(),
8586
email: "email/violation".to_owned(),
8687
};
8788

policies/schema/compat_login_input.json

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
"title": "CompatLoginInput",
44
"description": "Input for the compatibility login policy.",
55
"type": "object",
6-
"required": [
7-
"is_interactive",
8-
"login_type",
9-
"requester",
10-
"session_counts",
11-
"session_replaced",
12-
"user"
13-
],
146
"properties": {
157
"user": {
168
"type": "object",
@@ -29,7 +21,7 @@
2921
"type": "boolean"
3022
},
3123
"is_interactive": {
32-
"description": "Whether the user is currently in an interactive context. For `m.login.password`: false For `m.login.sso`: - true when asking for consent, - false when actually performing the login (at which point we create the compat session, but it's too late to show a web page)",
24+
"description": "Whether the user is currently in an interactive context.\n For `m.login.password`: false\n For `m.login.sso`:\n - true when asking for consent,\n - false when actually performing the login (at which point we create the\n compat session, but it's too late to show a web page)",
3325
"type": "boolean"
3426
},
3527
"login_type": {
@@ -39,38 +31,46 @@
3931
"$ref": "#/definitions/Requester"
4032
}
4133
},
34+
"required": [
35+
"user",
36+
"session_counts",
37+
"session_replaced",
38+
"is_interactive",
39+
"login_type",
40+
"requester"
41+
],
4242
"definitions": {
4343
"SessionCounts": {
4444
"description": "Information about how many sessions the user has",
4545
"type": "object",
46-
"required": [
47-
"compat",
48-
"oauth2",
49-
"personal",
50-
"total"
51-
],
5246
"properties": {
5347
"total": {
5448
"type": "integer",
5549
"format": "uint64",
56-
"minimum": 0.0
50+
"minimum": 0
5751
},
5852
"oauth2": {
5953
"type": "integer",
6054
"format": "uint64",
61-
"minimum": 0.0
55+
"minimum": 0
6256
},
6357
"compat": {
6458
"type": "integer",
6559
"format": "uint64",
66-
"minimum": 0.0
60+
"minimum": 0
6761
},
6862
"personal": {
6963
"type": "integer",
7064
"format": "uint64",
71-
"minimum": 0.0
65+
"minimum": 0
7266
}
73-
}
67+
},
68+
"required": [
69+
"total",
70+
"oauth2",
71+
"compat",
72+
"personal"
73+
]
7474
},
7575
"CompatLoginType": {
7676
"type": "string",
@@ -85,12 +85,18 @@
8585
"properties": {
8686
"ip_address": {
8787
"description": "IP address of the entity making the request",
88-
"type": "string",
88+
"type": [
89+
"string",
90+
"null"
91+
],
8992
"format": "ip"
9093
},
9194
"user_agent": {
9295
"description": "User agent of the entity making the request",
93-
"type": "string"
96+
"type": [
97+
"string",
98+
"null"
99+
]
94100
}
95101
}
96102
}

0 commit comments

Comments
 (0)