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: Lightweight SA token validation for OIDC auth — TokenReview only, no RBAC queries
Replace KubernetesTokenParser delegation with a lightweight
_validate_k8s_sa_token_and_extract_namespace() method in OidcTokenParser.
Validates SA tokens via TokenReview API and extracts namespace from the
authenticated identity. No RoleBinding/ClusterRoleBinding queries needed,
so the server SA only requires tokenreviews/create permission.
Also updates OIDC auth documentation with token priority, verify_ssl,
groups claim, and multi-token support sections.
Made-with: Cursor
Copy file name to clipboardExpand all lines: docs/getting-started/components/authz_manager.md
+55-14Lines changed: 55 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,52 +40,87 @@ auth:
40
40
With OIDC authorization, the Feast client proxies retrieve the JWT token from an OIDC server (or [Identity Provider](https://openid.net/developers/how-connect-works/))
41
41
and append it in every request to a Feast server, using an [Authorization Bearer Token](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#bearer).
42
42
43
-
The server, in turn, uses the same OIDC server to validate the token and extract the user roles from the token itself.
43
+
The server, in turn, uses the same OIDC server to validate the token and extract user details — including username, roles, and groups — from the token itself.
44
44
45
45
Some assumptions are made in the OIDC server configuration:
46
46
* The OIDC token refers to a client with roles matching the RBAC roles of the configured `Permission`s (*)
47
-
* The roles are exposed in the access token that is passed to the server
47
+
* The roles are exposed in the access token under `resource_access.<client_id>.roles`
48
48
* The JWT token is expected to have a verified signature and not be expired. The Feast OIDC token parser logic validates for `verify_signature` and `verify_exp` so make sure that the given OIDC provider is configured to meet these requirements.
49
-
* The preferred_username should be part of the JWT token claim.
50
-
49
+
* The `preferred_username` should be part of the JWT token claim.
50
+
* For `GroupBasedPolicy` support, the `groups` claim should be present in the access token (requires a "Group Membership" protocol mapper in Keycloak).
51
51
52
52
(*) Please note that **the role match is case-sensitive**, e.g. the name of the role in the OIDC server and in the `Permission` configuration
53
53
must be exactly the same.
54
54
55
-
For example, the access token for a client `app` of a user with `reader` role should have the following `resource_access` section:
55
+
For example, the access token for a client `app` of a user with `reader` role and membership in the `data-team` group should have the following claims:
56
56
```json
57
57
{
58
+
"preferred_username": "alice",
58
59
"resource_access": {
59
60
"app": {
60
61
"roles": [
61
62
"reader"
62
63
]
63
64
}
64
-
}
65
+
},
66
+
"groups": [
67
+
"data-team"
68
+
]
65
69
}
66
70
```
67
71
68
-
An example of feast OIDC authorization configuration on the server side is the following:
72
+
#### Server-Side Configuration
73
+
74
+
The server requires `auth_discovery_url` and `client_id` to validate incoming JWT tokens via JWKS:
In case of client configuration, the following settings username, password and client_secret must be added to specify the current user:
84
+
When the OIDC provider uses a self-signed or untrusted TLS certificate (e.g. internal Keycloak on OpenShift), set `verify_ssl` to `false` to disable certificate verification:
Setting `verify_ssl: false` disables TLS certificate verification for all OIDC provider communication (discovery, JWKS, token endpoint). Only use this in development or internal environments where you accept the security risk.
95
+
{% endhint %}
96
+
97
+
#### Client-Side Configuration
98
+
99
+
The client supports multiple token source modes. The SDK resolves tokens in the following priority order:
6. **Kubernetes service account token** — read from `/var/run/secrets/kubernetes.io/serviceaccount/token` when running inside a pod
107
+
108
+
**Token passthrough** (for use with external token providers like [kube-authkit](https://github.com/opendatahub-io/kube-authkit)):
109
+
```yaml
110
+
project: my-project
111
+
auth:
112
+
type: oidc
113
+
token_env_var: FEAST_OIDC_TOKEN
114
+
```
115
+
116
+
Or with a bare `type: oidc` (no other fields) — the SDK falls back to the `FEAST_OIDC_TOKEN` environment variable or a mounted Kubernetes service account token:
79
117
```yaml
118
+
project: my-project
80
119
auth:
81
120
type: oidc
82
-
...
83
-
username: _USERNAME_
84
-
password: _PASSWORD_
85
-
client_secret: _CLIENT_SECRET__
86
121
```
87
122
88
-
Below is an example of feast full OIDC client auth configuration:
When using client credentials or ROPC flows, the `verify_ssl` setting also applies to the discovery and token endpoint requests.
136
+
137
+
#### Multi-Token Support (OIDC + Kubernetes Service Account)
138
+
139
+
When the Feast server is configured with OIDC auth and deployed on Kubernetes, the `OidcTokenParser` can handle both Keycloak JWT tokens and Kubernetes service account tokens. Incoming tokens that contain a `kubernetes.io` claim are validated via the Kubernetes Token Access Review API and the namespace is extracted from the authenticated identity — no RBAC queries are performed, so the server service account only needs `tokenreviews/create` permission. All other tokens follow the standard OIDC/Keycloak JWKS validation path. This enables `NamespaceBasedPolicy` enforcement for service account tokens while using `GroupBasedPolicy` and `RoleBasedPolicy` for OIDC user tokens.
140
+
100
141
### Kubernetes RBAC Authorization
101
142
With Kubernetes RBAC Authorization, the client uses the service account token as the authorizarion bearer token, and the
102
143
server fetches the associated roles from the Kubernetes RBAC resources. Feast supports advanced authorization by extracting user groups and namespaces from Kubernetes tokens, enabling fine-grained access control beyond simple role matching. This is achieved by leveraging Kubernetes Token Access Review, which allows Feast to determine the groups and namespaces associated with a user or service account.
0 commit comments