Skip to content

Make FunctionContext the resource that is passed into IAuthorizationService #27

@MaxGuernseyIII

Description

@MaxGuernseyIII

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions