HTTP Request-Level Authentication with SpiceDB #1526
-
I'm considering integrating authorization into my application at the level of the http request. There's an emerging convergence around this idea of doing that in a reverse proxy by doing a precheck request, forwarding the request details including headers off to a remote authn/authz endpoint, and using the response code to determine whether to allow the request through to the real backend. Some implementations:
One benefit of this design is that it dissociates both the application and the proxy from authn/authz concerns, and isolates that problem to a simple http endpoint. Now, I understand that authzed is focused on authz not authn, and also that the strategy zanzibar and spicedb takes is to authorize at the object level. But lets assume that the application is designed such that it's possible to cleanly map http paths to objects, and that authn is handled. What do you think about using spicedb for this purpose? Any ideas for implementing "map http paths to objects"? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @infogulch, at authzed we consider this to be a good fit for SpiceDB and in fact are using it internally this way to power some of our services. With SpiceDB's 1.24.0 recent changes to the support slashes in object identifiers, you could easily map resource paths. You could extract authN information from headers or a JWT, and use it as the subject identifier. For example, a A |
Beta Was this translation helpful? Give feedback.
Hey @infogulch,
at authzed we consider this to be a good fit for SpiceDB and in fact are using it internally this way to power some of our services. With SpiceDB's 1.24.0 recent changes to the support slashes in object identifiers, you could easily map resource paths.
You could extract authN information from headers or a JWT, and use it as the subject identifier.
For example, a
POST https://example.com/books/3
would turn into a call to SpiceDB'sWriteRelationships
API writing the tuplebooks:1#creator@user#johndoe
. You could also check ifjohndoe
is allowed to create books by issuing aCheckPermission
API call to SpiceDB.A
GET https://example.com/books/3
could be turned into aCheckPermi…