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
This is a demo to showcase what can be done with Open Policy Agent around authorization in the Stackable Data Platform.
9
10
It covers the following aspects of security:
@@ -16,7 +17,7 @@ This demo will:
16
17
***Spark*: A multi-language engine for executing data engineering, data science, and machine learning. This demo uses it to create a (rather simple) report and write the results back into the persistence.
17
18
***HDFS*: A distributed file system that is designed to scale up from single servers to thousands of machines, each offering local computation and storage.
18
19
***Hive metastore*: A service that stores metadata related to Apache Hive and other services. This demo uses it as metadata storage for Trino and Spark.
19
-
***Open policy agent (OPA)*: An open-source, general-purpose policy engine unifies policy enforcement across the stack. This demo uses it as the authorizer for Trino and HDFS, which decides which user can query which data.
20
+
***Open policy agent (OPA)*: An open-source, general-purpose policy engine unifies policy enforcement across the stack. This demo uses it as the authorizer for Trino and HDFS, which decides which user can query which data. It also assigns Superset roles based on the Keycloak group memberships.
20
21
***Superset*: A modern data exploration and visualization platform. This demo utilizes Superset to retrieve data from Trino via SQL queries and build dashboards on top of that data.
21
22
* Configure security to showcase the following features
22
23
** Column- and row-level filtering
@@ -101,6 +102,10 @@ The following user accounts are configured in Keycloak:
101
102
|mark.ketting
102
103
|mark.ketting
103
104
|Head of Marketing
105
+
106
+
|admin
107
+
|adminadmin
108
+
|Superset administrator, not member of any department
104
109
|===
105
110
106
111
[#ruleset]
@@ -323,6 +328,24 @@ When clicking on the button, you are redirected to the Superset UI being already
323
328
324
329
image::end-to-end-security/superset_2.png[]
325
330
331
+
=== Superset role assignment via OPA
332
+
333
+
Which dashboards a user can see in Superset is determined by Superset roles.
334
+
Instead of assigning these roles manually, Superset asks OPA for the roles of a user at every login (configured via `roleMappingFromOpa` on the SupersetCluster).
335
+
OPA derives the roles from the Keycloak group memberships using the user-info-fetcher - the same group lookup the Trino rules are based on.
336
+
The mapping is defined in the {superset-regorules}[superset-regorules ConfigMap]:
337
+
338
+
* Every user gets the `Gamma` and `sql_lab` roles, granting access to the Superset UI including SQL Lab.
339
+
* Members of a department additionally get the role granting access to the datasets of their department, e.g. members of `/Customer Service/Analytics` get the `Customer Service Analytics` role and with it the `Customer analytics` dashboard.
340
+
* The `admin` user is assigned the Superset `Admin` role, so Superset can be administered via Single Sign On as well.
341
+
342
+
You can try this out by logging in to Superset as `pamela.scott` (Customer Analytics) and `william.lewis` (Compliance Analytics) and comparing the dashboards each of them sees.
343
+
Adding a user to a department group in Keycloak is all that is needed: on the next login, the user is assigned the matching Superset roles automatically.
344
+
345
+
Note that the Superset roles only control which dashboards and datasets are visible.
346
+
The data shown in the charts is still protected by Trino and OPA, because Superset impersonates the logged-in user when querying Trino.
347
+
Also note that role assignments made in the Superset UI are overwritten on the next login of the affected user - the Rego rules are the single source of truth.
348
+
326
349
=== Open Policy Agent for the utmost flexibility in building access rules
327
350
328
351
Some examples of access rules you can define for the Open Policy Agent authorization mechanism were already shown in the <<column-row-filtering, Column- and row-level filtering section>>. For more examples, check out the {trino-policies}[trino-policies ConfigMap] of this demo and also the https://www.youtube.com/watch?v=ATlq_l3WNiA&t=1970s[ACL section of the 'Mastering Data Platform Security' recording from above].
0 commit comments