Skip to content

Commit fc5c87b

Browse files
committed
Fix auth tests
Signed-off-by: Terence <terencelimxp@gmail.com>
1 parent 3834444 commit fc5c87b

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

sdk/python/feast/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ class ConfigOptions(metaclass=ConfigMeta):
7979
#: Enable user authentication to Feast Core
8080
ENABLE_AUTH: str = "False"
8181

82-
#: Auth token for user authentication to Feast Core
83-
ENABLE_AUTH_TOKEN: str = ""
82+
#: Auth token for user authentication to Feast
83+
AUTH_TOKEN: str = ""
8484

8585
#: Path to certificate(s) to secure connection to Feast Core
8686
CORE_SERVER_SSL_CERT: str = ""

sdk/python/feast/grpc/auth.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,23 @@ def __init__(self, config: Config):
6666
self._token = None
6767

6868
# If provided, set a static token
69-
if config.exists(ConfigOptions.ENABLE_AUTH_TOKEN):
70-
self._static_token = config.get(ConfigOptions.ENABLE_AUTH_TOKEN)
69+
if (
70+
config.exists(ConfigOptions.AUTH_TOKEN)
71+
and config.get(ConfigOptions.AUTH_TOKEN) != ""
72+
):
73+
self._static_token = config.get(ConfigOptions.AUTH_TOKEN)
7174
self._refresh_token(config)
7275
elif (
7376
config.exists(ConfigOptions.OAUTH_GRANT_TYPE)
7477
and config.exists(ConfigOptions.OAUTH_CLIENT_ID)
7578
and config.exists(ConfigOptions.OAUTH_CLIENT_SECRET)
7679
and config.exists(ConfigOptions.OAUTH_AUDIENCE)
7780
and config.exists(ConfigOptions.OAUTH_TOKEN_REQUEST_URL)
81+
and config.get(ConfigOptions.OAUTH_GRANT_TYPE) != ""
82+
and config.get(ConfigOptions.OAUTH_CLIENT_ID) != ""
83+
and config.get(ConfigOptions.OAUTH_CLIENT_SECRET) != ""
84+
and config.get(ConfigOptions.OAUTH_AUDIENCE) != ""
85+
and config.get(ConfigOptions.OAUTH_TOKEN_REQUEST_URL) != ""
7886
):
7987
self._refresh_token(config)
8088
else:
@@ -162,8 +170,11 @@ def __init__(self, config: Config):
162170
self._token = None
163171

164172
# If provided, set a static token
165-
if config.exists(ConfigOptions.ENABLE_AUTH_TOKEN):
166-
self._static_token = config.get(ConfigOptions.ENABLE_AUTH_TOKEN)
173+
if (
174+
config.exists(ConfigOptions.AUTH_TOKEN)
175+
and config.get(ConfigOptions.AUTH_TOKEN) != ""
176+
):
177+
self._static_token = config.get(ConfigOptions.AUTH_TOKEN)
167178

168179
self._request = requests.Request()
169180
self._refresh_token()

0 commit comments

Comments
 (0)