You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add an example of access control at the API Gateway level with APISIX and the plugin authz-openfga, based on the article Mastering Access Control: Implementing Low-Code Authorization Based on ReBAC and the Decoupling Pattern.
Copy file name to clipboardexpand all lines: README.md
+10-3
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ In this new version of the PoC we have a direct integration between the Access M
5
5
6
6
This workshop is based the following article [Keycloak integration with OpenFGA (based on Zanzibar) for Fine-Grained Authorization at Scale (ReBAC)](https://embesozzi.medium.com/keycloak-integration-with-openfga-based-on-zanzibar-for-fine-grained-authorization-at-scale-d3376de00f9a). You will find there full details about the authorization architecture guidelines and involved components.
7
7
8
+
In the latest version, I aimed to continue improving the authorization architecture and provide an agnostic approach for exposing and protecting APIs following best practices such as Policy as Code (PaC), decoupling authorization, and low-code authorization. Therefore, I added an identity-aware API gateway, Apache APISIX, as an API sidecar to the authorization architecture to enforce authorization and decouple it from the backend. The gateway uses a plugin I developed called [authz-openfga](https://github.com/embesozzi/apisix-authz-openfga) that supports Relationship-Based Access Control (ReBAC) policies because it's integrated with OpenFGA platform. The details are explained in the following article [Mastering Access Control: Implementing Low-Code Authorization Based on ReBAC and Decoupling Pattern](https://medium.com/@embesozzi/mastering-access-control-implementing-low-code-authorization-based-on-rebac-and-decoupling-pattern-f6f54f70115e)
8
9
9
10
## Authorization Framework (New)
10
11
@@ -23,7 +24,10 @@ The following diagram illustrates the solution architecture of this workshop:
23
24
* OpenFGA is responsible for applying fine-grained access control. The OpenFGA service answers authorization checks by determining whether a relationship exists between an object and a user.
24
25
* Other components
25
26
* Store Web Application is integrated with Keycloak by OpenID Connect
26
-
* Store API is protected by OAuth 2.0 and it utilizes the OpenFGA SDK for FGA
27
+
* Store Authorization Gateway exposes and protects the Store API with ReBAC policies integrated with the OpenFGA Platform (Protection at API Gateway).
28
+
29
+
You can also have Store OpenFGA API is protected by OAuth 2.0 and it utilizes the OpenFGA SDK for FGA as example (Protection at API Level).
30
+
27
31
28
32
Another cool feature of custom extension is its capability to discover the OpenFGA authorization model and determine which events are handled. This gives you the flexibility to choose your authorization model, whether it’s RBAC, GBAC, or both 🙌.
29
33
@@ -49,7 +53,7 @@ Another cool feature of custom extension is its capability to discover the OpenF
49
53
3. To be able to use this environment, you need to add this line to your local HOSTS file:
50
54
51
55
```sh
52
-
127.0.0.1 keycloak openfga store store-api
56
+
127.0.0.1 keycloak openfga store store-openfga-api store-authz-gateway
53
57
```
54
58
55
59
4. Access the following web UIs using URLs bellow via a web browser.
@@ -59,7 +63,8 @@ Another cool feature of custom extension is its capability to discover the OpenF
| Store Portal | http://store:9090 || Custom image |
62
-
| Store API | http://store-api:9091 || Custom image |
66
+
| Store Authorization Gateway | http://store-authz-gateway:9080 || Custom image based Apache APISIX Gateway |
67
+
| Store OpenFGA API | http://store-openfga:9091 || Custom image |
63
68
64
69
65
70
@@ -108,6 +113,8 @@ As an example, we will implement an Product Catalog web application that has the
108
113
109
114
You can follow the test cases described in the [Keycloak integration with OpenFGA (based on Zanzibar) for Fine-Grained Authorization at Scale (ReBAC)](https://embesozzi.medium.com/keycloak-integration-with-openfga-based-on-zanzibar-for-fine-grained-authorization-at-scale-d3376de00f9a).
110
115
116
+
And the article [Mastering Access Control: Implementing Low-Code Authorization Based on ReBAC and Decoupling Pattern](https://medium.com/@embesozzi/mastering-access-control-implementing-low-code-authorization-based-on-rebac-and-decoupling-pattern-f6f54f70115e).
117
+
111
118
Nevertheless, the use cases are detailed below:
112
119
113
120
### Use case 1: Access to the Store for managing products as an Analyst (Paula)
0 commit comments