Make FunctionContext the resource that is passed into IAuthorizationService
I would like to make the executing function context be the resource passed to the authorization service and, therefore, to the handlers.
I tried to create a pull request for this but I don't generally contribute to open source projects and gave up when I was denied the ability to create a new branch.
I could not find a "how to contribute" section in the documentation.
The change is nigh unto trivial. In the test AuthorizationFunctionMiddlewareShould, (currently line 97):
var authorizationService = Substitute.For<IAuthorizationService>();
var context = Substitute.For<FunctionContext>();
authorizationService.AuthorizeAsync(Arg.Any<ClaimsPrincipal>(), context, requirements)
.Returns(AuthorizationResult.Failed());
In AuthorizationFunctionMiddleware, (currently line 60):
var authorizationResult = await _authorizationService.AuthorizeAsync(authenticationResult.User, executingContext, requirements);
In AuthorizationFilter, (currently line 52):
var authorizationResult = await _authorizationService.AuthorizeAsync(httpContext.User, executingContext, requirements);
I could not locate the tests for AuthorizationFilter.
I would gladly submit this as a PR but, as an open source noob, I'm afraid I don't know how to do that with this project.
I figured out how to make a pull request. I had to create a fork for it, which feels weird but maybe that was right. Here is the link to the pull request.
https://github.com/fmichellonet/AzureFunctions.Extensions.OpenIDConnect/pull/28
Has anyone had a chance to look at this?