DavidParks8 / Owin-Authorization

Backport of Asp.Net core's policy based authorization to Asp.Net 4
Other
60 stars 16 forks source link

Blocking of async call in ResourceAuthorize attribute causes a deadlock #66

Closed adamkirkton closed 2 years ago

adamkirkton commented 4 years ago

My team ran into this when using the ResourceAuthorize attribute in a standard Web API project where sometimes calls would unexpectedly hang. I remembered from past reading here about what might cause this behavior.

So when I checked the ResourceAuthorize attribute and saw the .Result I knew that was most likely the cause. Testing in our own fork confirmed it was fixed by awaiting the call to IsAuthorizedAsync. I am putting up a corresponding PR for the simple fix.