Skip to content

Commit 203e390

Browse files
committed
First documentation draft
1 parent 6a8f8e7 commit 203e390

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

docs/modules/superset/pages/usage-guide/security.adoc

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,66 @@ Further information for specifying an AuthenticationClass for an OIDC provider c
126126
Superset has a concept called `Roles` which allows you to grant user permissions based on roles.
127127
Have a look at the {superset-security}[Superset documentation on Security^{external-link-icon}^].
128128

129+
=== [[Opa]] Opa Roles Mapping
130+
131+
Superset can sync roles from open policy agent. Currently only mapping is enabled as a larger refactoring of the upstream superset concerning their security management is announced.
132+
133+
In order to map roles from Opa into superset, we expect rego rules with a rule name `user_roles`. In the below example two users `admin` and `testuser` have roles defined as rego rule in Rego V1 to be complient with OPA v1.0.0 release.
134+
135+
IMPORTANT: Only role mapping is enabled. Permissions can only be added through the Superset UI. RBAC through OPA is not implemented.
136+
137+
[source,yaml]
138+
----
139+
apiVersion: v1
140+
kind: ConfigMap
141+
metadata:
142+
name: superset-opa-regorules
143+
labels:
144+
opa.stackable.tech/bundle: "true"
145+
data:
146+
roles.rego: |
147+
package superset
148+
149+
import rego.v1
150+
151+
default user_roles := []
152+
153+
user_roles := roles if {
154+
some user in users
155+
roles := user.roles
156+
user.username == input.username
157+
}
158+
159+
users := [
160+
{"username": "admin", "roles": ["Admin", "Test"]},
161+
{"username": "testuser", "roles": ["El_Testos", "Custom2"]}
162+
]
163+
----
164+
165+
Mounting this `configMap` in superset as follows:
166+
167+
[source,yaml]
168+
----
169+
apiVersion: superset.stackable.tech/v1alpha1
170+
kind: SupersetCluster
171+
metadata:
172+
name: superset-with-opa-role-mapping
173+
spec:
174+
clusterConfig:
175+
authorization:
176+
roleMappingFromOpa:
177+
configMapName: superset-opa-regorules # <1>
178+
package: superset
179+
cache: # <2>
180+
entryTimeToLive: 10s # <3>
181+
maxEntries: 5 # <4>
182+
----
183+
184+
<1> ConfigMap name containing rego rules
185+
<2> Mandatory Opa caching. Reduces calls to OPA API.
186+
<3> Time for cached entries per user can live. Defaults to 30s.
187+
<4> Number of maximum entries, defaults to 1000. Cache will be disabled for maxEntries: 0.
188+
129189
=== Superset database
130190

131191
You can view all the available roles in the web interface of Superset and can also assign users to these roles.

0 commit comments

Comments
 (0)