Skip to content

Commit

Permalink
Fix SAMLAuth backend to correctly return social auth pipeline results (
Browse files Browse the repository at this point in the history
  • Loading branch information
newswangerd authored Aug 30, 2024
1 parent ac6c563 commit c59c64c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion awx/sso/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from django.conf import settings as django_settings
from django.core.signals import setting_changed
from django.utils.encoding import force_str
from django.http import HttpResponse

# django-auth-ldap
from django_auth_ldap.backend import LDAPSettings as BaseLDAPSettings
Expand Down Expand Up @@ -316,7 +317,13 @@ def authenticate(self, request, *args, **kwargs):
]
):
return None
user = super(SAMLAuth, self).authenticate(request, *args, **kwargs)
pipeline_result = super(SAMLAuth, self).authenticate(request, *args, **kwargs)

if isinstance(pipeline_result, HttpResponse):
return pipeline_result
else:
user = pipeline_result

# Comes from https://github.com/omab/python-social-auth/blob/v0.2.21/social/backends/base.py#L91
if getattr(user, 'is_new', False):
enterprise_auth = _decorate_enterprise_user(user, 'saml')
Expand Down

0 comments on commit c59c64c

Please sign in to comment.