-
First/Last Name: Yi sheng Chai
-
Email: [email protected]
-
School/University: Chongqing University
-
Location: Chongqing, China
-
Timezone: China Standard Time (CST), UTC+8
-
Github Profile: https://github.com/hackerchai
-
Student: Yi sheng Chai
-
Mentors: Yang Luo, Cheng Jiang, Joey Xie
-
Organization: Casbin
-
Project Name: Impelement the Async SQL Adapter and Actix-web middleware for Casbin-rs
Casbin-RS aims at building reliable and high-performance library supporting various model access control for Rust projects. In the past months, I have developed Casbin Sqlx Adapter to support fully Async with Casbin Database Adapter, which gives developers an alternative in database adapter selection as well as a more high-performance adapter.
In addition, now all the components of Casbin-RS have intergrated with Github Action CI and Auto-Release support.
Actix-web is the the most popular Rust web framework at present. It is also known as the fastest web framework. With powerful extractors and extensible features, we can build rust-web application easily. In the past months, I am working on how to intergration Casbin with Actix-web together.
With Casbin Actix-web Middleware, It will provide a basic middleware to reads username(from other AuthN middleware), request path, request method from an user request and sends enforce request (subject, domain, object, action) to casbin enforcer for authorization. The middleware wll block the request if enforcer denied the request. We can automatically handle request with authorization control with this.
With Casbin Actix-web Actor, we can wrap casbin into an actor for a safer and easier way to call in request handle. In the actix system, actors are objects which encapsulate state and behavior and run within the Actor System provided by the actix library. We build this actor for basic CRUD operation of casbin instance
Casbin Actix-web Real World App is a fully functional demo which intergrated with Actix-web, Casbin Actix-web Middleware , Casbin Actix-web Actor, Diesel, Casbin Diesel Adaper. It is basically an Anonymous Forum which has admin-user system. With the intergration of casbin, it can authorize the requests and add policies when new user registered. This app provides a set of RESTful API using JWT authentication. This can be seen as an example for developers to use casbin with actix-web.
My Weekly Development Report can be seen here.
All the commits made by me: commit-list, this repo is mainly maintained by me.
- Basic Api Implemntation
- Test Module For Functions
- Multi-Databse support: Including MySQL/PostgreSQL
- Fully Async Support
- CI/CD Intergrations: Github Actions
- Auto-Release: Github Actions
- Database Environment Setupt: Docker
- Document Writing
All the commits made by me: commit-list, this repo is mainly maintained by me.
- Basic Function Implementation
- Test Module For Middleware
- Support for AuthN Middleware Intergration
- Support Domain Model and Domian-less Model
- Support Get/Set Enforcer for Flexible Demand
- CI/CD Intergrations: Github Actions
- Auto-Release: Github Actions
- Document Writing
All the commits made by me: commit-list, this repo is mainly maintained by me.
- Basic Casbin Function Implementation
- Test Module for Actor Runtime
- Support Actix Supervisor: Auto-Restart Feature
- Support Get/Set Enforcer for Flexible Dem,and
- CI/CD Intergrations: Github Actions
- Auto-Release: Github Actions
- Document Writing
All the commits made by me: commit-list, this module is mainly maintained by me.
- Basic Restful API Implementation using Actix-web: Anonymous Forum
- Intergration with Casbin Actix-web Middleware and Casbin Actix-web Actor
- User JWT Authentication Middleware Implementation
- Database Design and Migration Implement
- Casbin Configuration and Structure Design
- URL White-list for Casbin AuthZ Middleware and JWT AuthN Middleware
- Preset Policy Databse Initial Implementation
- CI/CD Intergrations: Github Actions
- Document Writing
All the commits made by me: commit-list
- Code Refactor and Optimization
- Database Environment Setup Improvement
- CI/CD Intergrations: Github Actions
- Auto-Release: Github Actions
- Document Writing Improvement
- Daily Maintenance and Upgrade
All the commits made by me: commit-list
- Casbin-Rs Actix Middleware & Actor Documentation
-
RwLock deadlock problem
When developing the middleware and actor, I have to use
RwLock
to wrap casbin instance to avoid Rust lifetime issue, they are all set and passed the Unit-Tests. But when I was developing the real-world-app, I encountered several Rwlock Deadlock problems, with my mentor's help, finally I successfully solve the problem by manually dropping the RwLock in case of middleware long-term holding the write lock. -
Sqlx compile-time checking and CI issues
Sqlx-rs uses the compile-time check which forces me to set the database environment up while compiling. When it comes to the CI, it becomes a little difficult for my first time of working with Github Actions. So I have to set up the database docker for the compile time-check. But here is the good news: Sqlx officially announced it will use sqlx-cli to avoid compile-time checking. When the feature comes to stable, I will try to port this feature to our Sqlx Adapter.
I will definitely continue contributing to Casbin, there are still a lot to do in the future:
- Implement new data structure for casbin-rs: For now, out data structure is
tree
, which causes the usage of lock and makes it hard to support multi-thread processing. In the future, maybe we can useindex tree
to solve this problem. - Implement RPC version of casbin-rs
@hackerchai Congratulations, have a great summer with @casbin 🎉