From 26875e52c67690015f7942f93236bb2cb37cebfd Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 30 Jul 2024 14:02:32 -0400 Subject: [PATCH] Fixup the type signatures of authnz backends. --- lib/galaxy/authnz/__init__.py | 4 ++-- lib/galaxy/authnz/custos_authnz.py | 2 +- lib/galaxy/authnz/managers.py | 2 +- lib/galaxy/authnz/psa_authnz.py | 4 ++-- lib/galaxy/model/deferred.py | 3 +++ 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/galaxy/authnz/__init__.py b/lib/galaxy/authnz/__init__.py index c2c5685e3180..071b09784bfe 100644 --- a/lib/galaxy/authnz/__init__.py +++ b/lib/galaxy/authnz/__init__.py @@ -43,7 +43,7 @@ def __init__(self, provider, config, backend_config): def refresh(self, trans, token): raise NotImplementedError() - def authenticate(self, provider, trans): + def authenticate(self, trans, idphint=None): """Runs for authentication process. Checks the database if a valid identity exists in the database; if yes, then the user is authenticated, if not, it generates a provider-specific @@ -72,7 +72,7 @@ def callback(self, state_token: str, authz_code: str, trans, login_redirect_url) """ raise NotImplementedError() - def disconnect(self, provider, trans, disconnect_redirect_url=None): + def disconnect(self, provider, trans, disconnect_redirect_url=None, email=None, association_id=None): raise NotImplementedError() def logout(self, trans, post_user_logout_href=None): diff --git a/lib/galaxy/authnz/custos_authnz.py b/lib/galaxy/authnz/custos_authnz.py index 806f6e1cafba..d6fdf22c8b31 100644 --- a/lib/galaxy/authnz/custos_authnz.py +++ b/lib/galaxy/authnz/custos_authnz.py @@ -343,7 +343,7 @@ def create_user(self, token, trans, login_redirect_url): trans.sa_session.commit() return login_redirect_url, user - def disconnect(self, provider, trans, email=None, disconnect_redirect_url=None): + def disconnect(self, provider, trans, disconnect_redirect_url=None, email=None, association_id=None): try: user = trans.user index = 0 diff --git a/lib/galaxy/authnz/managers.py b/lib/galaxy/authnz/managers.py index 93fc3c010ac3..7ec758fd3cac 100644 --- a/lib/galaxy/authnz/managers.py +++ b/lib/galaxy/authnz/managers.py @@ -432,7 +432,7 @@ def disconnect(self, provider, trans, email=None, disconnect_redirect_url=None, if success is False: return False, message, None elif provider in KEYCLOAK_BACKENDS: - return backend.disconnect(provider, trans, email, disconnect_redirect_url) + return backend.disconnect(provider, trans, disconnect_redirect_url, email=email) return backend.disconnect(provider, trans, disconnect_redirect_url) except Exception: msg = f"An error occurred when disconnecting authentication with `{provider}` identity provider for user `{trans.user.username}`" diff --git a/lib/galaxy/authnz/psa_authnz.py b/lib/galaxy/authnz/psa_authnz.py index b8a34b68e710..c222e76ebe09 100644 --- a/lib/galaxy/authnz/psa_authnz.py +++ b/lib/galaxy/authnz/psa_authnz.py @@ -193,7 +193,7 @@ def refresh(self, trans, user_authnz_token): return True return False - def authenticate(self, trans): + def authenticate(self, trans, idphint=None): on_the_fly_config(trans.sa_session) strategy = Strategy(trans.request, trans.session, Storage, self.config) backend = self._load_backend(strategy, self.config["redirect_uri"]) @@ -224,7 +224,7 @@ def callback(self, state_token, authz_code, trans, login_redirect_url): return redirect_url, self.config.get("user", None) - def disconnect(self, provider, trans, disconnect_redirect_url=None, association_id=None): + def disconnect(self, provider, trans, disconnect_redirect_url=None, email=None, association_id=None): on_the_fly_config(trans.sa_session) self.config[setting_name("DISCONNECT_REDIRECT_URL")] = ( disconnect_redirect_url if disconnect_redirect_url is not None else () diff --git a/lib/galaxy/model/deferred.py b/lib/galaxy/model/deferred.py index d73517fb756a..6cfaa75a0dcb 100644 --- a/lib/galaxy/model/deferred.py +++ b/lib/galaxy/model/deferred.py @@ -177,6 +177,9 @@ def ensure_materialized( return materialized_dataset_instance def _stream_source(self, target_source: DatasetSource, datatype) -> str: + source_uri = target_source.source_uri + if source_uri is None: + raise Exception("Cannot stream from dataset source without specified source_uri") path = stream_url_to_file(target_source.source_uri, file_sources=self._file_sources) transform = target_source.transform or [] to_posix_lines = False