@@ -222,3 +222,35 @@ test_mas_scopes if {
222222 with input.grant_type as " authorization_code"
223223 with input.scope as " urn:mas:admin"
224224}
225+
226+ test_session_limiting if {
227+ authorization_grant.allow with input.user as user
228+ with input.session_counts as {" total" : 1 }
229+ with data.session_limit as {" soft_limit" : 32 , " hard_limit" : 64 }
230+
231+ authorization_grant.allow with input.user as user
232+ with input.session_counts as {" total" : 31 }
233+ with data.session_limit as {" soft_limit" : 32 , " hard_limit" : 64 }
234+
235+ not authorization_grant.allow with input.user as user
236+ with input.session_counts as {" total" : 32 }
237+ with data.session_limit as {" soft_limit" : 32 , " hard_limit" : 64 }
238+
239+ not authorization_grant.allow with input.user as user
240+ with input.session_counts as {" total" : 42 }
241+ with data.session_limit as {" soft_limit" : 32 , " hard_limit" : 64 }
242+
243+ not authorization_grant.allow with input.user as user
244+ with input.session_counts as {" total" : 65 }
245+ with data.session_limit as {" soft_limit" : 32 , " hard_limit" : 64 }
246+
247+ # No limit configured
248+ authorization_grant.allow with input.user as user
249+ with input.session_counts as {" total" : 1 }
250+ with data.session_limit as null
251+
252+ # Client credentials grant
253+ authorization_grant.allow with input.user as user
254+ with input.session_counts as null
255+ with data.session_limit as {" soft_limit" : 32 , " hard_limit" : 64 }
256+ }
0 commit comments