Skip to content

Commit

Permalink
Fixup the type signatures of authnz backends.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Jul 30, 2024
1 parent be96afd commit 2e661fb
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/galaxy/authnz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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, disconnect_redirect_url=None, email=None, association_id=None):
raise NotImplementedError()

def logout(self, trans, post_user_logout_href=None):
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/authnz/custos_authnz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/authnz/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}`"
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/authnz/psa_authnz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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 ()
Expand Down
3 changes: 3 additions & 0 deletions lib/galaxy/model/deferred.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(f"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
Expand Down

0 comments on commit 2e661fb

Please sign in to comment.