Skip to content

Commit d601957

Browse files
committed
SAML bug fixes
* Fix error casting request_xml to bytes when request_xml is an object
1 parent 46f9b83 commit d601957

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

djangosaml2/views.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
from saml2.ident import code, decode
4949
from saml2.sigver import MissingKey
5050
from saml2.s_utils import UnsupportedBinding
51+
from saml2.samlp import AuthnRequest
5152
from saml2.response import (
5253
StatusError, StatusAuthnFailed, SignatureError, StatusRequestDenied,
5354
UnsolicitedResponse, StatusNoAuthnContext,
@@ -227,6 +228,9 @@ def login(request,
227228
**kwargs)
228229
try:
229230
if PY3:
231+
if isinstance(request_xml, AuthnRequest):
232+
# request_xml will be an instance of AuthnRequest if the message is not signed
233+
request_xml = str(request_xml)
230234
saml_request = base64.b64encode(binary_type(request_xml, 'UTF-8')).decode('utf-8')
231235
else:
232236
saml_request = base64.b64encode(binary_type(request_xml))

0 commit comments

Comments
 (0)