|
88 | 88 | "local": "feast.infra.feature_servers.local_process.config.LocalFeatureServerConfig", |
89 | 89 | } |
90 | 90 |
|
| 91 | +ALLOWED_AUTH_TYPES = ["no_auth", "kubernetes", "oidc"] |
| 92 | + |
91 | 93 | AUTH_CONFIGS_CLASS_FOR_TYPE = { |
92 | 94 | "no_auth": "feast.permissions.auth_model.NoAuthConfig", |
93 | 95 | "kubernetes": "feast.permissions.auth_model.KubernetesAuthConfig", |
94 | 96 | "oidc": "feast.permissions.auth_model.OidcAuthConfig", |
| 97 | + "oidc_client": "feast.permissions.auth_model.OidcClientAuthConfig", |
95 | 98 | } |
96 | 99 |
|
97 | 100 |
|
@@ -291,11 +294,17 @@ def offline_store(self): |
291 | 294 | def auth_config(self): |
292 | 295 | if not self._auth: |
293 | 296 | if isinstance(self.auth, Dict): |
294 | | - self._auth = get_auth_config_from_type(self.auth.get("type"))( |
295 | | - **self.auth |
| 297 | + is_oidc_client = ( |
| 298 | + self.auth.get("type") == AuthType.OIDC.value |
| 299 | + and "username" in self.auth |
| 300 | + and "password" in self.auth |
| 301 | + and "client_secret" in self.auth |
296 | 302 | ) |
| 303 | + self._auth = get_auth_config_from_type( |
| 304 | + "oidc_client" if is_oidc_client else self.auth.get("type") |
| 305 | + )(**self.auth) |
297 | 306 | elif isinstance(self.auth, str): |
298 | | - self._auth = get_auth_config_from_type(self.auth.get("type"))() |
| 307 | + self._auth = get_auth_config_from_type(self.auth)() |
299 | 308 | elif self.auth: |
300 | 309 | self._auth = self.auth |
301 | 310 |
|
@@ -336,22 +345,21 @@ def _validate_auth_config(cls, values: Any) -> Any: |
336 | 345 | from feast.permissions.auth_model import AuthConfig |
337 | 346 |
|
338 | 347 | if "auth" in values: |
339 | | - allowed_auth_types = AUTH_CONFIGS_CLASS_FOR_TYPE.keys() |
340 | 348 | if isinstance(values["auth"], Dict): |
341 | 349 | if values["auth"].get("type") is None: |
342 | 350 | raise ValueError( |
343 | | - f"auth configuration is missing authentication type. Possible values={allowed_auth_types}" |
| 351 | + f"auth configuration is missing authentication type. Possible values={ALLOWED_AUTH_TYPES}" |
344 | 352 | ) |
345 | | - elif values["auth"]["type"] not in allowed_auth_types: |
| 353 | + elif values["auth"]["type"] not in ALLOWED_AUTH_TYPES: |
346 | 354 | raise ValueError( |
347 | 355 | f'auth configuration has invalid authentication type={values["auth"]["type"]}. Possible ' |
348 | | - f"values={allowed_auth_types}" |
| 356 | + f'values={ALLOWED_AUTH_TYPES}' |
349 | 357 | ) |
350 | 358 | elif isinstance(values["auth"], AuthConfig): |
351 | | - if values["auth"].type not in allowed_auth_types: |
| 359 | + if values["auth"].type not in ALLOWED_AUTH_TYPES: |
352 | 360 | raise ValueError( |
353 | 361 | f'auth configuration has invalid authentication type={values["auth"].type}. Possible ' |
354 | | - f"values={allowed_auth_types}" |
| 362 | + f'values={ALLOWED_AUTH_TYPES}' |
355 | 363 | ) |
356 | 364 | return values |
357 | 365 |
|
|
0 commit comments