Moyens GraphQL
Casbin follows the officially suggested way to provide authorization for GraphQL endpoints by having a single source of truth for authorization: https://graphql.org/learn/authorization/. In other words, Casbin should be placed between the GraphQL layer and your business logic.
// La logique d'autorisation Casbin vit dans postRepository
var postRepository = require('postRepository');
var postType = new GraphQLObjectType({
name: 'Post',
champs: {
body: {
type: GraphQLString,
résolve: (post, argus, contexte, { rootValue }) => {
return postRepository. etBody(context.user, post);
}
}
}
});
Supported GraphQL Middlewares
A complete list of Casbin GraphQL middlewares is provided below. Any third-party contributions on a new GraphQL middleware are welcomed. Please inform us, and we will add it to this list:)
- Go
- Node.js
- Python
Middleware | Implémentation GraphQL | Auteur | Description |
---|---|---|---|
auth-graphql | graphql | Casbin | Un middleware d'autorisation pour graphql-go |
graphql-casbin | graphql | @esmaeilpour | An implementation of using Graphql and Casbin together |
format@@0 gqlgen_casbin_RBAC_example | Gqlgen | @WenyXu | (vide) |
Middleware | Implémentation GraphQL | Auteur | Description |
---|---|---|---|
auth-graphql | GraphQL.js | Casbin | Un middleware d'autorisation Casbin pour GraphQL.js |
Middleware | Implémentation GraphQL | Auteur | Description |
---|---|---|---|
auth-graphql | GraphQL-core 3 | @Checho3388 | Un middleware d'autorisation Casbin pour GraphQL-core 3 |