From cee3aad9bd919e2faf50aa9f9c0dd2115c29bda2 Mon Sep 17 00:00:00 2001 From: Sergey Uzhakov Date: Tue, 11 Jun 2024 15:06:29 +0300 Subject: [PATCH] Revert "Merge pull request #430 support sa_key from string from uzhastik/load_sa_key_from_string" This reverts commit 7eaac7d1b4fd61aa347e41bc93d5ec68b5212c0a, reversing changes made to c43a80faf5110e12fd78693d24f01f6bf527abac. --- ydb/iam/auth.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/ydb/iam/auth.py b/ydb/iam/auth.py index 613b92ad..7b4fa4e8 100644 --- a/ydb/iam/auth.py +++ b/ydb/iam/auth.py @@ -99,22 +99,14 @@ def set_token_expiration_timeout(self, value): @classmethod def from_file(cls, key_file, iam_endpoint=None, iam_channel_credentials=None): with open(os.path.expanduser(key_file), "r") as r: - key = r.read() - - return BaseJWTCredentials.from_content( - cls, key, iam_endpoint=iam_endpoint, iam_channel_credentials=iam_channel_credentials - ) - - @classmethod - def from_content(cls, key, iam_endpoint=None, iam_channel_credentials=None): - key_json = json.loads(key) - account_id = key_json.get("service_account_id", None) + output = json.loads(r.read()) + account_id = output.get("service_account_id", None) if account_id is None: - account_id = key_json.get("user_account_id", None) + account_id = output.get("user_account_id", None) return cls( account_id, - key_json["id"], - key_json["private_key"], + output["id"], + output["private_key"], iam_endpoint=iam_endpoint, iam_channel_credentials=iam_channel_credentials, )