Starcounter/Starcounter.Authorization

Incompatible permission argument type - exception is thrown only once

Closed this issue · 1 comments

Repro

  • Page is IBound to Foo.
  • Permission BarPermission expects Bar in constructor
  • I check this permission on Handle method in page [RequirePermission(typeof(BarPermission))]
  • basically any wrong usage of RequirePermissionAttribute would trigger this bug

Actual behavior

  • When I go to the page for the first time, following exception is presented, but only once:
System.Exception: Could not create check for page SomePage and permission BarPermission. Make sure the page is of type IBound<Bar>
   at Starcounter.Authorization.PageSecurity.PageSecurity.CheckersCreator.CreateThrowingCheckFromExistingPage(Type pageType, ICustomAttributeProvider attributeProvider) in...
  • After reload everything works almost normally, without checking permission on given Handle.

Expected behavior
I would rather expect to throw exception every time this page is loaded, to force developer to fix this problem. Without that, Handle is not secured at all.

cc @joozek78

outdated