From 172864a3a10220b81cdb9029b14b9e1e1a675709 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Fri, 12 Jul 2019 14:00:26 -0400 Subject: [PATCH] Force the username and password to be strings under the Radius backend The base Radius backend encodes them as utf-8 bytes, which causes the User object that we create to get the repr of the username, including the b prefix and single quotes, e.g. "b'foo'". --- awx/sso/backends.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/sso/backends.py b/awx/sso/backends.py index 13fd4be02f..35990e4622 100644 --- a/awx/sso/backends.py +++ b/awx/sso/backends.py @@ -13,6 +13,7 @@ from django.dispatch import receiver from django.contrib.auth.models import User from django.conf import settings as django_settings from django.core.signals import setting_changed +from django.utils.encoding import force_text # django-auth-ldap from django_auth_ldap.backend import LDAPSettings as BaseLDAPSettings @@ -209,7 +210,7 @@ class RADIUSBackend(BaseRADIUSBackend): return user def get_django_user(self, username, password=None): - return _get_or_set_enterprise_user(username, password, 'radius') + return _get_or_set_enterprise_user(force_text(username), force_text(password), 'radius') class TACACSPlusBackend(object):