4 years ago replied hackerchai 's topic› GSoC2020 › GSoC 2020 Weekly Report - Casbin Rust |
4 years ago replied hackerchai 's topic› GSoC2020 › GSoC 2020 Weekly Report - Casbin Rust |
This week, I successfully intergrated casbin middleware into real-world-app. Althouth the dead lock problem costs me few days to work on it. But thanks to my mentor's help, I finally found the problem.
The real-world-app development is finished.
4 years ago replied hackerchai 's topic› GSoC2020 › GSoC 2020 Weekly Report - Casbin Rust |
This week, I intergrate casbin actor into the project and encountered bugs. Because casbin new version doesn't dupport pattern in g policies (like "g2, /post/:id, post_group"), so I have to use p policies instead.
4 years ago replied hackerchai 's topic› GSoC2020 › GSoC 2020 Weekly Report - Casbin Rust |
This week, I add JWT middleware to real-world-app. Due to support the casbin middleware I put user's username into Actix Extensions which can be also retieved in the HttpRequest when handling data. To difference user's login state, I add LoginSession
into user table, and put it into JWT body to check whether whe user is logout.
4 years ago replied hackerchai 's topic› GSoC2020 › GSoC 2020 Weekly Report - Casbin Rust |
In my coding time this week, I found that in real-world we can not generate two enforcers in the app. Or it will be mistakes with data syncing. So the middleware and actor should share the same enforcer. So I make commits to implement this.
Besides, I am woking on Post model and service. When handling new_post object, there are some fields not providing by the user's request, so I use serde default field feature to implement this finally.
Post controller
JWT middleware
4 years ago replied hackerchai 's topic› GSoC2020 › GSoC 2020 Weekly Report - Casbin Rust |
This week, I am working on the service and controller part of user system. I met some Diesel issues and they are tough to solve. With the help of my mentor and blog posts, I finally solved them.
4 years ago replied hackerchai 's topic› GSoC2020 › GSoC 2020 Weekly Report - Casbin Rust |
User
finishDue to the final exam in university, merge two weeks into one report. Mainly working on the User model of real-world-app.
4 years ago replied hackerchai 's topic› GSoC2020 › GSoC 2020 Weekly Report - Casbin Rust |
Since pattern
is removed from casbin new version, I use KeyMatch function in p policies instead. So I bump a new version of casbin.
4 years ago replied hackerchai 's topic› GSoC2020 › GSoC 2020 Weekly Report - Casbin Rust |
Since add_matching_fn
function has been deprecated in casbin 1.0.0, I found that without matching_fn function I ccan still implement similiar feature using KeyMatch2
in confifuration file. So we will still use this in the real-world app.
4 years ago replied hackerchai 's topic› GSoC2020 › GSoC 2020 Weekly Report - Casbin Rust |
Casbin-rs has released the 1.0.0 version. Some functions have been made into sync and some functions have been deprecated. Through the benchmark, casbin-rs has a huge performance improvement.
Besides, the add_matching_fn
function has been deprecated. But it is needed in real-world circumstance. So it is of necessity to bring it back in next release and also improve its performance.
add_matching_fn
function back4 years ago replied hackerchai 's topic› GSoC2020 › GSoC 2020 Weekly Report - Casbin Rust |
For docker environment, I am using https://github.com/hackerchai/docker-rust-web.
4 years ago replied hackerchai 's topic› GSoC2020 › GSoC 2020 Weekly Report - Casbin Rust |
Diesel
orm library and trying to optimize SQL in sqlx adapterActix
and diesel
Rocket
to check how Roccket
implements Middleware
First of all, the highest priority job is to implement a real-world-app using actix-casbin-auth, after discussion with my mentor, I decide to write an anonymous shudong to give an example of casbin-rs with RBAC model. I will choose PostgreSQL as database backend and JWT as default authentication method.
As for Rocket
, the middleware
is called Fairings. So it is available for us to implement a middleware similar to Actix.