GraphQL Middlewares
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.
// Casbin-Autorisierungslogik lebt im PostRepository
var postRepository = require('postRepository');
var postType = new GraphQLObjectType({
name: 'Post',
Felder: {
body: {
type: GraphQLString,
Auflösung: (Post, Args, Kontext, { 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 | GraphQL Implementierung | Autor | Beschreibung |
---|---|---|---|
graphql-authz | graphql | Casbin | Eine Autorisierungs-Middleware für graphql-go |
graphql-casbin | graphql | @esmaeilpour | An implementation of using Graphql and Casbin together |
gqlgen_casbin_RBAC_Beispiel | gqlgen | @WenyXu | (leer) |
Middleware | GraphQL Implementierung | Autor | Beschreibung |
---|---|---|---|
graphql-authz | GraphQL.js | Casbin | Eine Casbin-Autorisierungs-Middleware für GraphQL.js |
Middleware | GraphQL Implementierung | Autor | Beschreibung |
---|---|---|---|
graphql-authz | GraphQL-Kern 3 | @Checho3388 | Eine Casbin-Autorisierungs-Middleware für GraphQL-core 3 |