Simple App with echo v4 Framework, Facebook ent and Casbin
Go to Project Folder then run the following command :
go generate ./ent
After generating ent schema resources, run the following command
go run .
First, you have to send a request to login endpoint to generate a new
JWT Token which will be used later for authenticating yourself to other
endpoints.
UserA -> has access to EndPoint /app/hello/{name} only
UserB -> has access to both EndPoints
curl -d '{"username":"mostafa", "password":"testtest"}' -H "Content-Type: application/json" -X POST http://localhost:8080/app/login
I've used casbinrest adapter (with some updates to work with echo v4) for integrating echo with casbin