File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 3737from django .views .decorators .http import require_POST
3838from django .shortcuts import render
3939from django .template import TemplateDoesNotExist
40- from django .utils .six import text_type , binary_type
40+ from django .utils .six import text_type , binary_type , PY3
4141from django .views .decorators .csrf import csrf_exempt
4242
4343from saml2 import BINDING_HTTP_REDIRECT , BINDING_HTTP_POST
@@ -202,10 +202,15 @@ def login(request,
202202 location ,
203203 binding = binding )
204204 try :
205+ if PY3 :
206+ saml_request = base64 .b64encode (binary_type (request_xml , 'UTF-8' ))
207+ else :
208+ saml_request = base64 .b64encode (binary_type (request_xml ))
209+
205210 http_response = render (request , post_binding_form_template , {
206211 'target_url' : location ,
207212 'params' : {
208- 'SAMLRequest' : base64 . b64encode ( binary_type ( request_xml , 'UTF-8' )) ,
213+ 'SAMLRequest' : saml_request ,
209214 'RelayState' : came_from ,
210215 },
211216 })
You can’t perform that action at this time.
0 commit comments