There are two main types, I'd say, of a modern authorization system. The first is what I mentioned earlier, which is a Google's Zanzibar system, where instead of putting roles or reducing everything into an attribute, you do something called Reback or relationship-based access control, where everything is in the form of a relationship. So a user has a relationship to a file, a file has a relationship to a folder, and you compute permissions based off of that. There are three ones that I can recommend from their open source, like SpiceDB, OpenFG, and Permafy. I work on SpiceDB, so of course I'm going to have a bias towards that.
And the second type is a policy decision point or a policy engine, where your authorization is a logic problem that's served by evaluating a policy. So if something passes that policy, you get a yes. And again, some popular ones include Open Policy Agent, CDER, and CERBOS. I'd say if you have something that has a lot of data and hierarchies and changes frequently, including things like AI and agents, et cetera, go for a Zanzibar system. If you want something where all the information is in the request call itself, I would go for a policy engine.
The idea, of course, is you're trading something that is relatively simple, like a JWT, and that is stateless, to something that might be a little more complex to implement at first, but you're getting correctness, flexibility, and most importantly, security, which I cannot stress this enough is so important right now. There are times you can use JWTs when you have a one-time non-revocable grant, like say an email verification link or a download link that expires in a day or whatever. But for production use cases like something long-lived, an app authorization decision, or anything fine grained, I would absolutely avoid using JWTs.
Now I know you have many questions about things like refresh tokens and storing things locally and all of that. I don't have the time to cover that, but that first link I put up there, which has this flow chart, will cover all your questions about using JWTs for fine-grained permissions. A couple of other things you can also read to learn more about this topic. I'd love to connect with you on LinkedIn and I hope you enjoy the rest of the conference. And remember, don't use JWTs for fine-grained permissions. Enjoy and have a great day. Bye.
Comments