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 37
37
from django .views .decorators .http import require_POST
38
38
from django .shortcuts import render
39
39
from 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
41
41
from django .views .decorators .csrf import csrf_exempt
42
42
43
43
from saml2 import BINDING_HTTP_REDIRECT , BINDING_HTTP_POST
@@ -202,10 +202,15 @@ def login(request,
202
202
location ,
203
203
binding = binding )
204
204
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
+
205
210
http_response = render (request , post_binding_form_template , {
206
211
'target_url' : location ,
207
212
'params' : {
208
- 'SAMLRequest' : base64 . b64encode ( binary_type ( request_xml , 'UTF-8' )) ,
213
+ 'SAMLRequest' : saml_request ,
209
214
'RelayState' : came_from ,
210
215
},
211
216
})
You can’t perform that action at this time.
0 commit comments