graphql-dotnet / graphql-dotnet/authorization

Selectively allow anonymous access

Open
#44 13 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C#
Stars
160
Forks
38
PR merge metrics
No merged PRs in 30d

Description

Is it possible to white list one or more endpoints?

for example: I would like to require authentication for all mutation and queries except for Login.

Currently we authorize each mutation individually - we fear forgetting one will ship and endpoint with open access. The query mutation we AuthorizeWith at the root level therefore it catches all endpoints.

If this is not possible with the current implementation, I am happy to create a PR but how would this work? Instead of AuthorizeWith on an endpoint have DisableAuthorization() ? This could add metadata that is inspected during evaluation to bypass root level policies. What are the drawbacks to this approach?

**Update**
Took the initial approach of removing operation level validation and the fields now inherit parent policies if they are not flagged a public.

Example
![image](https://user-images.githubusercontent.com/50211405/57340601-806dd400-7104-11e9-98ee-fbe059a653ce.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.