From 6a6405d75f6fd9b352702f3bedeb67b29c98f3af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 15 Apr 2016 10:26:25 +0200 Subject: [PATCH] misc: allow unicode strings as authn classref (#10666) --- mellon/views.py | 3 ++- tests/test_views.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mellon/views.py b/mellon/views.py index e5d6e5b..7bab9a3 100644 --- a/mellon/views.py +++ b/mellon/views.py @@ -338,9 +338,10 @@ class LoginView(ProfileMixin, LogMixin, View): # configure requested AuthnClassRef authn_classref = utils.get_setting(idp, 'AUTHN_CLASSREF') if authn_classref: + authn_classref = tuple([str(x) for x in authn_classref]) req_authncontext = lasso.Samlp2RequestedAuthnContext() authn_request.requestedAuthnContext = req_authncontext - req_authncontext.authnContextClassRef = tuple(authn_classref) + req_authncontext.authnContextClassRef = authn_classref self.set_next_url(next_url) login.buildAuthnRequestMsg() except lasso.Error, e: diff --git a/tests/test_views.py b/tests/test_views.py index bb42316..42bfd8f 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -198,8 +198,8 @@ def test_sp_initiated_login_chosen(private_settings, client): def test_sp_initiated_login_requested_authn_context(private_settings, client): private_settings.MELLON_IDENTITY_PROVIDERS = [{ 'METADATA': open('tests/metadata.xml').read(), - 'AUTHN_CLASSREF': ['urn:be:fedict:iam:fas:citizen:eid', - 'urn:be:fedict:iam:fas:citizen:token'], + 'AUTHN_CLASSREF': [u'urn:be:fedict:iam:fas:citizen:eid', + u'urn:be:fedict:iam:fas:citizen:token'], }] response = client.get('/login/') assert response.status_code == 302 -- 2.8.0.rc3