@@ -48,6 +48,7 @@ def csrf_exempt(view_func):
48
48
from saml2 .ident import code , decode
49
49
from saml2 .sigver import MissingKey
50
50
from saml2 .response import StatusError
51
+ from saml2 .xmldsig import SIG_RSA_SHA1 # support for this is required by spec
51
52
52
53
from djangosaml2 .cache import IdentityCache , OutstandingQueriesCache
53
54
from djangosaml2 .cache import StateCache
@@ -158,15 +159,15 @@ def login(request,
158
159
159
160
client = Saml2Client (conf )
160
161
http_response = None
161
-
162
+
162
163
logger .debug ('Redirecting user to the IdP via %s binding.' , binding )
163
164
if binding == BINDING_HTTP_REDIRECT :
164
165
try :
165
- # we use sign kwarg to override in case of redirect binding
166
- # otherwise pysaml2 may sign the xml for redirect which is incorrect
166
+ # do not sign the xml itself, instead us the sigalg to
167
+ # generate the signature as a URL param
167
168
session_id , result = client .prepare_for_authenticate (
168
169
entityid = selected_idp , relay_state = came_from ,
169
- binding = binding , sign = False )
170
+ binding = binding , sign = False , sigalg = SIG_RSA_SHA1 )
170
171
except TypeError as e :
171
172
logger .error ('Unable to know which IdP to use' )
172
173
return HttpResponse (text_type (e ))
0 commit comments