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
| `auth.audience` | The audience for the IDP. | | OPENTDF_SERVER_AUTH_AUDIENCE |
72
-
| `auth.issuer` | The issuer for the IDP. | | OPENTDF_SERVER_AUTH_ISSUER |
73
-
| `auth.cache_refresh` | Interval in which the IDP jwks should be refreshed | `15m` | OPENTDF_SERVER_AUTH_CACHE_REFRESH |
74
-
| `auth.dpopskew` | The amount of time drift allowed between when the client generated a dpop proof and the server time. | `1h` | OPENTDF_SERVER_AUTH |
75
-
| `auth.skew` | The amount of time drift allowed between a tokens `exp` claim and the server time. | `1m` | OPENTDF_SERVER_AUTH_SKEW |
76
-
| `auth.public_client_id` | The oidc client id. This is leveraged by otdfctl. | | OPENTDF_SERVER_AUTH_PUBLIC_CLIENT_ID |
77
-
| `auth.enforceDPoP` | If true, DPoP bindings on Access Tokens are enforced. | `false` | OPENTDF_SERVER_AUTH_ENFORCEDPOP |
78
-
| `cryptoProvider` | A list of public/private keypairs and their use. Described [below](#crypto-provider) | empty | |
| `auth.audience` | The audience for the IDP. | | OPENTDF_SERVER_AUTH_AUDIENCE |
72
+
| `auth.issuer` | The issuer for the IDP. | | OPENTDF_SERVER_AUTH_ISSUER |
73
+
| `auth.policy` | The Casbin policy for enforcing authorization on endpoints. Described [below](#casbin-endpoint-authorization) | | |
74
+
| `auth.cache_refresh` | Interval in which the IDP jwks should be refreshed | `15m` | OPENTDF_SERVER_AUTH_CACHE_REFRESH |
75
+
| `auth.dpopskew` | The amount of time drift allowed between when the client generated a dpop proof and the server time. | `1h` | OPENTDF_SERVER_AUTH |
76
+
| `auth.skew` | The amount of time drift allowed between a tokens `exp` claim and the server time. | `1m` | OPENTDF_SERVER_AUTH_SKEW |
77
+
| `auth.public_client_id` | The oidc client id. This is leveraged by otdfctl. | | OPENTDF_SERVER_AUTH_PUBLIC_CLIENT_ID |
78
+
| `auth.enforceDPoP` | If true, DPoP bindings on Access Tokens are enforced. | `false` | OPENTDF_SERVER_AUTH_ENFORCEDPOP |
79
+
| `cryptoProvider` | A list of public/private keypairs and their use. Described [below](#crypto-provider) | empty | |
| `tls.cert` | The path to the tls certificate. | | OPENTDF_SERVER_TLS_CERT |
86
+
| `tls.key` | The path to the tls key. | | OPENTDF_SERVER_TLS_KEY |
86
87
87
88
Example:
88
89
@@ -216,4 +217,91 @@ services:
216
217
rego:
217
218
path: /path/to/policy.rego
218
219
query: data.opentdf.entitlements.attributes
219
-
```
220
+
```
221
+
222
+
### Casbin Endpoint Authorization
223
+
224
+
OpenTDF uses Casbin to manage authorization policies. This document provides an overview of how to configure and manage the default authorization policy in OpenTDF.
225
+
226
+
#### Key Aspects of Authorization Configuration
227
+
228
+
1. **Default Role**: The default role assigned to an authorized user if no specific role is found.
229
+
2. **Claim**: The claim in the OIDC token that should be used to map roles.
230
+
3. **Map**: Mapping between policy roles and IdP roles.
231
+
4. **CSV**: The authorization policy in CSV format.
232
+
5. **Model**: The Casbin policy model.
233
+
234
+
#### Configuration in opentdf-example.yaml
235
+
236
+
Below is an example configuration snippet from
237
+
opentdf-example.yaml:
238
+
239
+
```yaml
240
+
server:
241
+
auth:
242
+
enabled: true
243
+
enforceDPoP: false
244
+
public_client_id: 'opentdf-public'
245
+
audience: 'http://localhost:8080'
246
+
issuer: http://keycloak:8888/auth/realms/opentdf
247
+
policy:
248
+
## Default role for all requests
249
+
default: "role:standard"
250
+
251
+
## Dot notation is used to access nested claims (i.e. realm_access.roles)
252
+
claim: "realm_access.roles"
253
+
254
+
## Maps the external role to the OpenTDF role
255
+
## Note: left side is used in the policy, right side is the external role
256
+
map:
257
+
standard: opentdf-standard
258
+
admin: opentdf-admin
259
+
org-admin: opentdf-org-admin
260
+
261
+
## Custom policy (see examples https://github.com/casbin/casbin/tree/master/examples)
- **Org Admin**: Can read, write, and perform unsafe mutations.
300
+
- **Admin**: Can read and write.
301
+
- **Standard User**: Can read.
302
+
- **Public Endpoints**: Accessible without specific roles.
303
+
304
+
#### Managing Authorization Policy
305
+
306
+
Admins can manage the authorization policy directly in the YAML configuration file. For detailed configuration options, refer to the [Casbin documentation](https://casbin.org/docs/en/syntax-for-models).
0 commit comments