@@ -49,7 +49,7 @@ def csrf_exempt(view_func):
4949from saml2 .sigver import MissingKey
5050from saml2 .s_utils import UnsupportedBinding
5151from 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
5353
5454from djangosaml2 .cache import IdentityCache , OutstandingQueriesCache
5555from djangosaml2 .cache import StateCache
@@ -168,9 +168,12 @@ def login(request,
168168 logger .debug ('Redirecting user to the IdP via %s binding.' , binding )
169169 if binding == BINDING_HTTP_REDIRECT :
170170 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
172172 # 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
174177 session_id , result = client .prepare_for_authenticate (
175178 entityid = selected_idp , relay_state = came_from ,
176179 binding = binding , sign = False , sigalg = sigalg )
0 commit comments