TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Casbin: An authorization library that supports authz models like ACL, RBAC, ABAC

63 pointsby hsluoyzabout 4 years ago

11 comments

FooBarWidgetabout 4 years ago
I had a look at Casbin in the past, in search of a Go equivalent of Ruby&#x27;s CanCanCan. But Casbin looks way too complicated to use. So in the end I wrote my own unreusable, poor man&#x27;s version of CanCanCan in Go specifically for use in my app (with lots of boilerplate and duplication because Go has no generics).<p>Does anybody else have a better experience with Casbin, or have recommendations on a CanCanCan-like alternative for Go?
评论 #26938535 未加载
Ideabileabout 4 years ago
Usually I’m not a detractor, but recently we evaluated Casbin and I would not recommend anybody to use it.
评论 #26936209 未加载
评论 #26935600 未加载
评论 #26935678 未加载
评论 #26935383 未加载
评论 #26936178 未加载
prplabout 4 years ago
I would like to know who uses this and how. It seems like deploying Ory Keto would be much better for web applications less you really need this like for a desktop application or something.
lmeyerovabout 4 years ago
We&#x27;re actively evaluating this, particular b&#x2F;c: Open, dynamic acl+rbc = modern google-docs-style policies for regular webapps, postgres adapters = no change in operations (vs keycloak, orly, ..). That&#x27;s been a fairly unique combo. However, we&#x27;re still doing our own eval because we saw concerning issues in the gh around perf+correctness, and it&#x27;s not obvious how to use it.<p>Curious on other experiences &#x2F; alternatives. Ex: We&#x27;re trying to keep the CMS parts of our stack especially boring, so django&#x2F;postgres&#x2F;casbin is surprisingly tight, while DB backing of a user&#x27;s&#x2F;org&#x27;s custom ACL&#x2F;RBAC sharing rules in say OPA seems more like a science project (despite looking like a great project when zoomed out), based on the docs (<a href="https:&#x2F;&#x2F;www.openpolicyagent.org&#x2F;docs&#x2F;latest&#x2F;external-data&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.openpolicyagent.org&#x2F;docs&#x2F;latest&#x2F;external-data&#x2F;</a>)<p>The casbin&lt;&gt;db integration decision was pretty wise, vs the continuing trend of policy engines bringing their own infra, and thus &#x27;the tail wagging the dog&#x27;. I&#x27;d love to see someone figuring out RBAC&#x2F;ABAC+ACLs as DB-native ~RLS, instead of having to introduce an extra moving piece of infra for every DB query, when the DB is right there!
edoceoabout 4 years ago
I tried this too. lots of flexibility (that we never needed. then had to fiddle with DB adapters, docs weren&#x27;t great so had to step with debugger to sort it.<p>its a neat design, its a nice promise but more of a reference for building the tightly integrated RBAC (or whatever) that you need.
TechBro8615about 4 years ago
It seems there are a number of emerging solutions to this problem. Casbin, Ory, and Keycloak come to mind. Has anyone tried multiple of them? I guess the nature of the beast is you probably only use one...<p>My main concern is stability, e.g. will this project be around in three years, and if not, is it grokkable and stable enough that the community could understand and maintain it?<p>We ended up rolling our own authn (kind of regrettable, but at least gives us some predictability and one less thing to update) but have not yet implemented authz.<p>Would be curious to hear from anyone who&#x27;s recently chosen between these options (or others) and is happy with their choice.
评论 #26936139 未加载
评论 #26935807 未加载
obiwanpallav1about 4 years ago
I had a nice experience in building a multi tenant system in which RBAC was done by Openpolicy Agent(OPA)[0].<p>Our data model was N Level hierarchies of entities for each tenant and these hierarchies followed inheritance for roles.<p>We made some policies in OPA and the membership data was present in the DB which was sent to OPA at startup. Then any diff made in membership was subsequently also sent to the OPA as well.<p>[0] <a href="https:&#x2F;&#x2F;www.openpolicyagent.org&#x2F;docs&#x2F;latest&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.openpolicyagent.org&#x2F;docs&#x2F;latest&#x2F;</a>
评论 #26939593 未加载
wkrauseabout 4 years ago
We used Casbin at my previous company where we needed to implement RBAC on top of our API that was written in Go. What we liked about it was that it could be embedded directly in our main application without needing to administer an external system. It also helped that we were using Postgres and redis as part of our stack as the casbin plugins for those tools made policy storage and enforcer updates dead simple across our API nodes.
motohagiographyabout 4 years ago
This looks appealing as a framework for using in IAM for applications with federated auth. Given historic legacy alterantives are lower level policy frameworks like RADIUS&#x2F;TACACS, SAML, XACML and UMA2, what are the objections to Casbin?<p>A library you can build into your application for doing policy AuthZ without having to deal with a centralized policy repository, while moving AuthN to your IAM gateway is a huge deal in enterprise envirionments.
toxikabout 4 years ago
I wish people would stop saying authz instead of authorization.
评论 #26935960 未加载
lahoda-xyzabout 4 years ago
graphs solve all these problems