From fb70dc7f62548d39f856a233f2c937c01691cc1e Mon Sep 17 00:00:00 2001 From: mikedarcy Date: Fri, 15 Mar 2024 14:10:23 -0700 Subject: [PATCH] Automatically update bdbag keychain with bearer-token in get_credential since it might have been refreshed. Don't build universal wheels anymore since Python 2 is no longer supported. --- deriva/core/__init__.py | 9 +++++++-- setup.cfg | 4 +--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/deriva/core/__init__.py b/deriva/core/__init__.py index 5c1c4553..dea8468e 100644 --- a/deriva/core/__init__.py +++ b/deriva/core/__init__.py @@ -17,7 +17,8 @@ def get_credential(host, config_file=DEFAULT_CONFIG_FILE, requested_scope=None, force_scope_lookup=False, - match_scope_tag="deriva-all"): + match_scope_tag="deriva-all", + update_bdbag_keychain=True): """ This function is used to get authorization credentials (in dict form) for use with various deriva-py API calls which take it as a parameter. A user must have already authenticated to the target host using either `deriva-auth` @@ -36,7 +37,9 @@ def get_credential(host, :param match_scope_tag: In the case that a host-to-scope mapping request returns multiple scopes, this is the key value ("tag") to match against in the result dict. By convention, the default is set to "deriva-all", which is the expected response from webauthn. - + :param update_bdbag_keychain: Updates the bdbag keychain file with the bearer token mapped to `host`. This is + done to ensure that the bdbag keychain is updated when a refreshable bearer-token gets refreshed during the + login check. Defaults to True. :return: A dict containing credential authorization values mapped by authorization type """ # load deriva credential set first @@ -64,6 +67,8 @@ def get_credential(host, match_scope_tag=match_scope_tag) if token: creds["bearer-token"] = token + if update_bdbag_keychain: + globus_client.update_bdbag_keychain(token=token, host=host) except Exception as e: logging.warning("Exception while getting Globus credentials: %s" % format_exception(e)) diff --git a/setup.cfg b/setup.cfg index 51d30b34..b9de1652 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,3 @@ [metadata] -description-file = README.md +description_file = README.md license_file = LICENSE -[bdist_wheel] -universal = 1 \ No newline at end of file