@@ -49,7 +49,7 @@ def csrf_exempt(view_func):
49
49
from saml2 .sigver import MissingKey
50
50
from saml2 .s_utils import UnsupportedBinding
51
51
from saml2 .response import StatusError
52
- from saml2 .xmldsig import SIG_RSA_SHA1 # support for this is required by spec
52
+ from saml2 .xmldsig import SIG_RSA_SHA1 , SIG_RSA_SHA256 # support for SHA1 is required by spec
53
53
54
54
from djangosaml2 .cache import IdentityCache , OutstandingQueriesCache
55
55
from djangosaml2 .cache import StateCache
@@ -168,9 +168,12 @@ def login(request,
168
168
logger .debug ('Redirecting user to the IdP via %s binding.' , binding )
169
169
if binding == BINDING_HTTP_REDIRECT :
170
170
try :
171
- # do not sign the xml itself, instead us the sigalg to
171
+ # do not sign the xml itself, instead use the sigalg to
172
172
# generate the signature as a URL param
173
- sigalg = SIG_RSA_SHA1 if sign_requests else None
173
+ sig_alg_option_map = {'sha1' : SIG_RSA_SHA1 ,
174
+ 'sha256' : SIG_RSA_SHA256 }
175
+ sig_alg_option = getattr (conf , '_sp_authn_requests_signed_alg' , 'sha1' )
176
+ sigalg = sig_alg_option_map [sig_alg_option ] if sign_requests else None
174
177
session_id , result = client .prepare_for_authenticate (
175
178
entityid = selected_idp , relay_state = came_from ,
176
179
binding = binding , sign = False , sigalg = sigalg )
0 commit comments