All Projects → jchristn → Gatekeeper

jchristn / Gatekeeper

Licence: MIT license
Lightweight library in C# for implementing roles-based access control (RBAC). With Gatekeeper, you can define users, roles, resources, and permissions, and authorize requests.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to Gatekeeper

react-rbac-ui-manager
react-rbac-ui-manager is a simple RBAC (Role Based Access Control) user interface library based on the material design system using the Material-UI lib.
Stars: ✭ 73 (+192%)
Mutual labels:  authorization, rbac, rbac-management, roles-management
rbac-react-redux-aspnetcore
A starter template for creating JWT token from ASP.NET Core API project and applying that JWT token authentication on React application
Stars: ✭ 54 (+116%)
Mutual labels:  authorization, rbac, rbac-management
Laratrust
Handle roles and permissions in your Laravel application
Stars: ✭ 1,799 (+7096%)
Mutual labels:  authorization, rbac
Negroni Authz
negroni-authz is an authorization middleware for Negroni
Stars: ✭ 152 (+508%)
Mutual labels:  authorization, rbac
Casbin Server
Casbin as a Service (CaaS)
Stars: ✭ 171 (+584%)
Mutual labels:  authorization, rbac
tp5-rbac
一个tp5的RBAC库,使用composer来安装和更新你的项目对于RBAC的需求。同时支持jwt方式的验证。包含了RBAC需要的数据表的数据迁移,能够很方便的开始开发。
Stars: ✭ 69 (+176%)
Mutual labels:  authorization, rbac
Accesscontrol
Role and Attribute based Access Control for Node.js
Stars: ✭ 1,723 (+6792%)
Mutual labels:  authorization, rbac
Think Authz
An authorization library that supports access control models like ACL, RBAC, ABAC in ThinkPHP 6.0 .
Stars: ✭ 155 (+520%)
Mutual labels:  authorization, rbac
Jcasbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Java
Stars: ✭ 1,335 (+5240%)
Mutual labels:  authorization, rbac
Chi Authz
chi-authz is an authorization middleware for Chi
Stars: ✭ 248 (+892%)
Mutual labels:  authorization, rbac
Caddy Authz
Caddy-authz is a middleware for Caddy that blocks or allows requests based on access control policies.
Stars: ✭ 221 (+784%)
Mutual labels:  authorization, rbac
Yii2 Usuario
Highly customizable and extensible user management, authentication, and authorization Yii2 extension
Stars: ✭ 251 (+904%)
Mutual labels:  authorization, rbac
Rbac.dev
A collection of good practices and tools for Kubernetes RBAC
Stars: ✭ 115 (+360%)
Mutual labels:  authorization, rbac
Node Casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Node.js and Browser
Stars: ✭ 1,757 (+6928%)
Mutual labels:  authorization, rbac
Caddy Auth Jwt
JWT Authorization Plugin for Caddy v2
Stars: ✭ 127 (+408%)
Mutual labels:  authorization, rbac
Casbin Cpp
An authorization library that supports access control models like ACL, RBAC, ABAC in C/C++
Stars: ✭ 113 (+352%)
Mutual labels:  authorization, rbac
Speedle
Speedle is an open source project for access control.
Stars: ✭ 153 (+512%)
Mutual labels:  authorization, rbac
aarbac
An Automated Role Based Access Control .NET framework with T-SQL Query Parser which automatically parse select, insert, update, delete queries based on the logged in user role
Stars: ✭ 18 (-28%)
Mutual labels:  nuget, authorization
Openstack Policy Editor
A Casbin Policy Editor for OpenStack
Stars: ✭ 28 (+12%)
Mutual labels:  authorization, rbac
Casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Golang
Stars: ✭ 10,872 (+43388%)
Mutual labels:  authorization, rbac

GateKeeper Roles-Based Access Control

NuGet Version NuGet

Roles-Based Access Control Library in C#

GateKeeper is a simple library for implementing roles-based access control to control access to resources by users given a specified operation type.

With GateKeeper, you can define users, roles, and permissions, then authorize access attempts to resources (by resource name and operation).

New in v2.0.0

  • Breaking changes and major refactor
  • Content sanitization on insert and authorization evaluation
  • Event handler for authorization decisions including evaluation metadata
  • Automatic cleanup of subordinate objects (for instance, deleting a user deletes any associated role maps)

Help, Feedback, and Disclaimer

First things first - do you need help or have feedback? File an issue or start a discussion! We would love to get your feedback to help make our software better. Also, there may be bugs or issues that we have yet to encounter!

Sample App

Refer to the GateKeeperConsole project for a working example. This project will initialize a database, and optionally, prepopulate it with a series of records allowing you to test functionality.

Sqlite and .NET Framework

You'll need to copy the runtimes directory into your application directory. Please refer to WatsonORM (see https://github.com/jchristn/watsonorm) Test.Sqlite project.

Enterprise Editions

If you wish to use GateKeeper in an enterprise application using your own database application, email me at joel dot christner at gmail dot com.

Getting Started

To get up and running with GateKeeper:

  1. Install the NuGet package
> Install-Package GateKeeper
  1. Add the appropriate using statements
using GateKeeper;
  1. Instantiate
RbacServer server = new RbacServer(); 
// or
RbacServer server = new RbacServer("MyDatabaseFilename.db");
  1. Create users
User user = new User("My first user");
server.Users.Add(user);
// users are entities that attempt to consume resources
  1. Create resources
Resource resource = new Resource("My first resource");
server.Resources.Add(resource);
// resources are entities that users attempt to consume
  1. Create roles
Role role = new Role("My first role");
server.Roles.Add(role);
// roles are entities to which permissions are mapped
  1. Create permissions
Permission perm = new Permission("My first permission", role, resource, "create", true);
// first parameter is the name of the permission
// second parameter is the role to which the permission should be assigned
// third parameter is the resource allowed or disallowed by the permission
// fourth parameter is the type of operation permitted or denied by this permission
// fifth parameter is whether or not the operation should be permitted
server.Permissions.Add(perm);
  1. Map users to roles
UserRole userRole = server.UserRoles.Add(user, role);
// this maps the user to the role defined in step 7
  1. Attempt an authorization!
bool authorized;

authorized = server.Authorize("My first user", "create", "My first resource");
// optionally, add metadata, which propagates to events
authorized = server.Authorize("My first user", "create", "My first resource", 42);
  1. Attach authorization event handler (optional)
server.AuthorizationEvent += MyEventHandler;

private static void MyEventHandler(object sender, AuthorizationEventArgs e)
{
  Console.WriteLine(e.Username + " attempted to " + e.Operation + " against " + e.Resource + ": " + e.Authorized);
}

Additional APIs

Each of the manager instances on RbacServer (Permissions, Resources, Roles, Users, UserRoles) have a series of APIs for managing the underlying data. These APIs include (not all are applicable to every manager):

  • Add
  • Remove
  • RemoveByName
  • All
  • GetFirstByName
  • ExistsByName
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].