FakeAuthorizationService also fails authorization against OperationAuthorizationRequirement - please add support #1725
Unanswered
mpeckatwork
asked this question in
Q&A
Replies: 1 comment
-
Hey hey @mpeckatwork By any chance do you have a minimal repro (your component under test and the test itself) to make our lives easier? That would be really appreaciated. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am unable to use the FakeAuthorizationService with my unit test as it always fails authorization regardless of other configuration.
Method in question is: public Task AuthorizeAsync(ClaimsPrincipal user, object? resource, IEnumerable requirements)
Looking at the code, there is no specific logic for this type of authorization requirement so it falls to the last else statement which returns a failure.
Add logic that supports simulating successful authorization of these types of IAuthorizationRequirements.
My best alternative for now is that I think I'm going to have to either override your method or create a custom FakeAuthorizationService and inject it.
Beta Was this translation helpful? Give feedback.
All reactions