admin: fix encoding handling in remote idp metadata update (#45269)
This commit is contained in:
parent
a96e9c769c
commit
44c8a61a9f
|
@ -5076,7 +5076,7 @@ def test_settings_idp(pub):
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
idp_metadata_filename = os.path.join(os.path.dirname(__file__), 'idp_metadata.xml')
|
||||
urlopen.side_effect = lambda *args: open(idp_metadata_filename)
|
||||
urlopen.side_effect = lambda *args: open(idp_metadata_filename, 'rb')
|
||||
resp = app.get('/backoffice/settings/identification/idp/idp/')
|
||||
resp = resp.click('Create new from remote URL')
|
||||
resp.form['metadata_url'] = 'http://authentic.example.net/idp/saml2/metadata'
|
||||
|
|
|
@ -14,12 +14,14 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import re
|
||||
|
||||
try:
|
||||
import lasso
|
||||
except ImportError:
|
||||
lasso = None
|
||||
|
||||
from django.utils.encoding import force_bytes
|
||||
from django.utils.encoding import force_bytes, force_text
|
||||
from django.utils.six.moves.urllib import parse as urllib
|
||||
from django.utils.six.moves.urllib import parse as urlparse
|
||||
|
||||
|
@ -655,7 +657,7 @@ class AdminIDPUI(Directory):
|
|||
metadata_fd = misc.urlopen(metadata_url)
|
||||
except misc.ConnectionError:
|
||||
return template.error_page('failed to download')
|
||||
metadata = metadata_fd.read()
|
||||
metadata = force_text(metadata_fd.read())
|
||||
|
||||
publickey_url = self.idp.get('publickey_url')
|
||||
if publickey_url:
|
||||
|
|
Loading…
Reference in New Issue