Skip to content

.NET Core 6 Authentication/Authorization Issue #925

Answered by Shane32
davehog asked this question in Q&A
Discussion options

You must be logged in to vote

Endpoint authorization, as described here in the readme, is all-or-nothing and applies authorization policies prior to allowing any connection to the GraphQL endpoint, whether for introspection requests or otherwise.

Field/type authorization, as described here in the readme, will allow introspection requests, as introspection fields implicitly have [AllowAnonymous] set. If you need a global authorization policy set while allowing introspection requests, simply add the proper policy to the query, mutation and subscription types.

// code-first sample
public class QueryGraphType : ObjectGraphType
{
    public QueryGraphType()
    {
        this.AuthorizeWithRoles("Administrators");
        /…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@davehog
Comment options

@Shane32
Comment options

@davehog
Comment options

Answer selected by davehog
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants