From 1bb9f068b555f29b00a4fb33ce7c546a91754f40 Mon Sep 17 00:00:00 2001 From: John Westcott IV Date: Wed, 4 Dec 2024 10:30:53 -0500 Subject: [PATCH] AAP-36845 Fix how we build AuthExceptions --- ansible_base/authentication/utils/authentication.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ansible_base/authentication/utils/authentication.py b/ansible_base/authentication/utils/authentication.py index d7c83cf56..d68cf48cf 100644 --- a/ansible_base/authentication/utils/authentication.py +++ b/ansible_base/authentication/utils/authentication.py @@ -91,7 +91,7 @@ def check_system_username(uid: str) -> None: """ if uid.casefold() == settings.SYSTEM_USERNAME.casefold(): logger.warning(f'{settings.SYSTEM_USERNAME} cannot log in from an authenticator!') - raise AuthException(_('System user is not allowed to log in from external authentication sources.')) + raise AuthException(None, _('System user is not allowed to log in from external authentication sources.')) def determine_username_from_uid_social(**kwargs) -> dict: @@ -101,12 +101,13 @@ def determine_username_from_uid_social(**kwargs) -> dict: selected_username = kwargs.get('details', {}).get(uid_field, None) if not selected_username: raise AuthException( - _('Unable to get associated username from attribute {uid_field}: %(details)s') % {'uid_field': uid_field, 'details': kwargs.get("details", None)} + None, + _('Unable to get associated username from attribute {uid_field}: %(details)s') % {'uid_field': uid_field, 'details': kwargs.get("details", None)}, ) authenticator = kwargs.get('backend') if not authenticator: - raise AuthException(_('Unable to get backend from kwargs')) + raise AuthException(None, _('Unable to get backend from kwargs')) alt_uid = authenticator.get_alternative_uid(**kwargs)