Skip to content

Commit 532e4a4

Browse files
committed
Update tests to prepare for needing C-S API scope
1 parent 560ebc2 commit 532e4a4

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

policies/authorization_grant/authorization_grant_test.rego

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,65 +78,65 @@ test_unstable_device_scopes if {
7878
authorization_grant.allow with input.user as user
7979
with input.client as client
8080
with input.grant_type as "authorization_code"
81-
with input.scope as "urn:matrix:org.matrix.msc2967.client:device:AAbbCCdd01"
81+
with input.scope as "urn:matrix:org.matrix.msc2967.client:api:* urn:matrix:org.matrix.msc2967.client:device:AAbbCCdd01"
8282

8383
authorization_grant.allow with input.user as user
8484
with input.client as client
8585
with input.grant_type as "authorization_code"
86-
with input.scope as "urn:matrix:org.matrix.msc2967.client:device:AAbbCCdd01-asdasdsa1-2313"
86+
with input.scope as "urn:matrix:org.matrix.msc2967.client:api:* urn:matrix:org.matrix.msc2967.client:device:AAbbCCdd01-asdasdsa1-2313"
8787

8888
# Too short
8989
not authorization_grant.allow with input.user as user
9090
with input.client as client
9191
with input.grant_type as "authorization_code"
92-
with input.scope as "urn:matrix:org.matrix.msc2967.client:device:abcd"
92+
with input.scope as "urn:matrix:org.matrix.msc2967.client:api:* urn:matrix:org.matrix.msc2967.client:device:abcd"
9393

9494
# Multiple device scope
9595
not authorization_grant.allow with input.user as user
9696
with input.client as client
9797
with input.grant_type as "authorization_code"
98-
with input.scope as "urn:matrix:org.matrix.msc2967.client:device:AAbbCCdd01 urn:matrix:org.matrix.msc2967.client:device:AAbbCCdd02"
98+
with input.scope as "urn:matrix:org.matrix.msc2967.client:api:* urn:matrix:org.matrix.msc2967.client:device:AAbbCCdd01 urn:matrix:org.matrix.msc2967.client:device:AAbbCCdd02"
9999

100100
# Allowed with the device code grant
101101
authorization_grant.allow with input.user as user
102102
with input.client as client
103103
with input.grant_type as "urn:ietf:params:oauth:grant-type:device_code"
104-
with input.scope as "urn:matrix:org.matrix.msc2967.client:device:AAbbCCdd01"
104+
with input.scope as "urn:matrix:org.matrix.msc2967.client:api:* urn:matrix:org.matrix.msc2967.client:device:AAbbCCdd01"
105105

106106
# Not authorization_grant.allowed for the client credentials grant
107107
not authorization_grant.allow with input.client as client
108108
with input.grant_type as "client_credentials"
109-
with input.scope as "urn:matrix:org.matrix.msc2967.client:device:AAbbCCdd01"
109+
with input.scope as "urn:matrix:org.matrix.msc2967.client:api:* urn:matrix:org.matrix.msc2967.client:device:AAbbCCdd01"
110110
}
111111

112112
test_stable_device_scopes if {
113113
authorization_grant.allow with input.user as user
114114
with input.client as client
115115
with input.grant_type as "authorization_code"
116-
with input.scope as "urn:matrix:client:device:AAbbCCdd01"
116+
with input.scope as "urn:matrix:client:api:* urn:matrix:client:device:AAbbCCdd01"
117117

118118
authorization_grant.allow with input.user as user
119119
with input.client as client
120120
with input.grant_type as "authorization_code"
121-
with input.scope as "urn:matrix:client:device:AAbbCCdd01-asdasdsa1-2313"
121+
with input.scope as "urn:matrix:client:api:* urn:matrix:client:device:AAbbCCdd01-asdasdsa1-2313"
122122

123123
# Too short
124124
not authorization_grant.allow with input.user as user
125125
with input.client as client
126126
with input.grant_type as "authorization_code"
127-
with input.scope as "urn:matrix:client:device:abcd"
127+
with input.scope as "urn:matrix:client:api:* urn:matrix:client:device:abcd"
128128

129129
# Multiple device scope
130130
not authorization_grant.allow with input.user as user
131131
with input.client as client
132132
with input.grant_type as "authorization_code"
133-
with input.scope as "urn:matrix:client:device:AAbbCCdd01 urn:matrix:client:device:AAbbCCdd02"
133+
with input.scope as "urn:matrix:client:api:* urn:matrix:client:device:AAbbCCdd01 urn:matrix:client:device:AAbbCCdd02"
134134

135135
# Allowed with the device code grant
136136
authorization_grant.allow with input.user as user
137137
with input.client as client
138138
with input.grant_type as "urn:ietf:params:oauth:grant-type:device_code"
139-
with input.scope as "urn:matrix:client:device:AAbbCCdd01"
139+
with input.scope as "urn:matrix:client:api:* urn:matrix:client:device:AAbbCCdd01"
140140

141141
# Not authorization_grant.allowed for the client credentials grant
142142
not authorization_grant.allow with input.client as client

0 commit comments

Comments
 (0)