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
Copy file name to clipboardExpand all lines: tests/Transports.AspNetCore.Tests/AuthorizationTests.cs
+31Lines changed: 31 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -775,6 +775,37 @@ public async Task EndToEnd(bool authenticated)
775
775
actual.ShouldBe("""{"errors":[{"message":"Access denied for field \u0027parent\u0027 on type \u0027QueryType\u0027.","locations":[{"line":1,"column":3}],"extensions":{"code":"ACCESS_DENIED","codes":["ACCESS_DENIED"]}}]}""");
776
776
}
777
777
778
+
[Theory]
779
+
[InlineData("Role1",false,false)]// User with Role1, child requires Role2 - should fail at child level
780
+
[InlineData("Role2",false,false)]// User with Role2, query requires Role1 - should fail at query level
781
+
[InlineData("Role1,Role2",false,true)]// User with both roles - should pass
782
+
[InlineData(null,false,false)]// Unauthenticated user - should fail at query level
783
+
[InlineData("Role1",true,false)]// User with Role1, child requires Role2 and is anonymous - should fail
784
+
[InlineData("Role2",true,true)]// User with Role2, child requires Role2 and is anonymous - should pass
785
+
[InlineData("Role1,Role2",true,true)]// User with both roles, child is anonymous - should pass
786
+
[InlineData(null,true,false)]// Unauthenticated user, child is anonymous - should fail as Role2 is missing
0 commit comments