Giter VIP home page Giter VIP logo

relation_fga's Introduction

RELATION FGA

Implementation of (F)ine (G)rade (A)uthorization inspired by OpenFGA

The motivation behind this project was to create a service that could handle the object list better than OpenFGA https://openfga.dev/. The mentioned solution is based on a relational database. The topic of permissions and accesses in my opinion is graphical in nature, so I decided to try it with graphs, preliminary benchmarks show a very big performance difference.

How it works:

  1. the DSL logic is parsed using ply to graph in networkx. An AuthModel is created
  2. the AuthModelService using the AuthService generates access paths on the graph from object A to object B. It filters them by the required permissions
  3. the access paths are converted into cypher commands that fly to memgraph.
  4. everything is wrapped in the grpc client

Benchmark

3 tests were conducted:

-1000 objects
-10,000 objects
-100,000 objects

For one user with id "1" who has relatively the most connections 100 requests for his access were carried out Alt text As you can see, RelationFGA is almost an order of magnitude faster than OpenFga. All the files needed to run the benchmark with instructions are in the src/benchmark path

Disclaimer

I am very open to criticism, I probably made mistakes

DEV GUIDE

PROTOS:

run commands from graph_fga/grpc folder:

$ python -m grpc_tools.protoc -I./protos --python_out=./pb2 --pyi_out=./pb2 --grpc_python_out=./pb2 protos/messages.proto
$ python -m grpc_tools.protoc -I./protos --python_out=./pb2 --pyi_out=./pb2 --grpc_python_out=./pb2 protos/services.proto

edit file services_pb2_grpc first line to:

from . import messages_pb2 as messages__pb2

TESTS:

GRPC tests:

$ docker compose run server_grpc pytest

relation_fga's People

Contributors

t1waz avatar

Stargazers

Krutilin Sergey avatar

Watchers

 avatar

relation_fga's Issues

Licence?

Hi, This looks like a really cool project. Have you decided on what kind of license you want this code to be under?

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.