Scenario:
I implemented resource based authorization inside my endpoint just like it's shown in microsoft documentation. It didn't work. I put a breakpoint inside my authorization handler and tried debugging, but when this handler should be called, it is not. I mean that when the following line runs
var authorizationResult = await _authorizationService
.AuthorizeAsync(User, Document, "EditPolicy");
the Handler should be called, but that never happens.
Did anyone have the same problem?
So in the end the problem was due to the registration of the service in the startup.cs. I was using TryAddScope, by changing to AddScope it worked fine.