Code Monkey home page Code Monkey logo

Comments (6)

sungam3r avatar sungam3r commented on July 19, 2024

If OK, I want to add this feature in v5.

from authorization.

Shane32 avatar Shane32 commented on July 19, 2024

I looked at the two methods within GraphQLAuthExtensions.cs file under Harness. It seems to me that they only need access to GraphQL.DI.IGraphQLBuilder as there is no MS-DI or ASP.Net-specific methods contained in there. These methods should be added to the current version of GraphQL.Authorization, without waiting for v5, as GraphQL.DI.IGraphQLBuilder was included in GraphQL.NET 4.6. I would not create another nuget package.

from authorization.

sungam3r avatar sungam3r commented on July 19, 2024

GraphQL.DI.IGraphQLBuilder 🤔 ? Is this a new project? I have not seen yet, 500 emails :(.

from authorization.

Shane32 avatar Shane32 commented on July 19, 2024

See https://graphql-dotnet.github.io/docs/getting-started/dependency-injection#dependency-injection-registration-helpers

Added and revised in:

from authorization.

Shane32 avatar Shane32 commented on July 19, 2024

Basically, it allows 3rd party libraries such as GraphQL.Authorization to do the following all within a single IGraphQLBuilder method:

  • Register services within the user's DI framework (any DI framework, and without a dependency)
  • Configure options using the options configuration pattern (without a dependency on the MS options pattern)
  • Configure schema options
  • Configure execution options

In this case, the new AddAuthorization method does 3 of the 4 listed above:

  • Configures authorization options based on the provided delegate
  • Registers necessary classes within the DI framework
  • Adds the authorization validation rule during execution

from authorization.

Shane32 avatar Shane32 commented on July 19, 2024

@sungam3r Check out this sample which uses the new IGraphQLBuilder approach:

https://github.com/graphql-dotnet/graphql-dotnet/blob/master/src/GraphQL.Harness/Startup.cs#L30..L51

from authorization.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.