14
14
from feast .repo_config import FeastConfigBaseModel
15
15
16
16
# pick the correct validator decorator for current Pydantic version
17
- try : # Pydantic ≥ 2.0
17
+ try : # Pydantic ≥ 2.0
18
18
from pydantic import model_validator as _v2 # type: ignore
19
19
20
20
def _cred_validator (fn ):
21
- return _v2 (mode = "after" )(fn ) # run after field validation
22
- except ImportError : # Pydantic 1.x
21
+ return _v2 (mode = "after" )(fn ) # run after field validation
22
+ except ImportError : # Pydantic 1.x
23
23
from pydantic import root_validator as _v1 # type: ignore
24
24
25
25
def _cred_validator (fn ):
@@ -37,19 +37,19 @@ class OidcAuthConfig(AuthConfig):
37
37
38
38
class OidcClientAuthConfig (OidcAuthConfig ):
39
39
# any **one** of the four fields below is sufficient
40
- username : Optional [str ] = None
41
- password : Optional [str ] = None
40
+ username : Optional [str ] = None
41
+ password : Optional [str ] = None
42
42
client_secret : Optional [str ] = None
43
- token : Optional [str ] = None # pre-issued `token`
43
+ token : Optional [str ] = None # pre-issued `token`
44
44
45
45
@_cred_validator
46
46
def _validate_credentials (cls , values ):
47
47
"""Enforce exactly one valid credential set."""
48
48
d = values .__dict__ if hasattr (values , "__dict__" ) else values
49
49
50
- has_user_pass = bool (d .get ("username" )) and bool (d .get ("password" ))
51
- has_secret = bool (d .get ("client_secret" ))
52
- has_token = bool (d .get ("token" ))
50
+ has_user_pass = bool (d .get ("username" )) and bool (d .get ("password" ))
51
+ has_secret = bool (d .get ("client_secret" ))
52
+ has_token = bool (d .get ("token" ))
53
53
54
54
# 1 static token
55
55
if has_token and not (has_user_pass or has_secret ):
0 commit comments