Skip to content

Commit 8cdd224

Browse files
committed
fix #280: better using pysaml2 SPConfig loader instead of global django settings!
1 parent 3f49c1e commit 8cdd224

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

djangosaml2/middleware.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def process_response(self, request, response):
6565
"request completed. The user may have logged "
6666
"out in a concurrent request, for example."
6767
)
68+
6869
response.set_cookie(
6970
self.cookie_name,
7071
request.saml_session.session_key,

djangosaml2/views.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,14 @@ def get(self, request, *args, **kwargs):
240240

241241
# SSO options
242242
sign_requests = getattr(conf, '_sp_authn_requests_signed', False)
243-
244243
if sign_requests:
245-
csc = settings.SAML_CONFIG['service']['sp']
246-
sso_kwargs["sigalg"] = csc.get('signing_algorithm',
247-
saml2.xmldsig.SIG_RSA_SHA256)
248-
sso_kwargs["digest_alg"] = csc.get('digest_algorithm',
249-
saml2.xmldsig.DIGEST_SHA256)
250-
244+
sso_kwargs["sigalg"] = getattr(conf, '_sp_signing_algorithm',
245+
saml2.xmldsig.SIG_RSA_SHA256
246+
)
247+
sso_kwargs["digest_alg"] = getattr(conf,
248+
'_sp_digest_algorithm',
249+
saml2.xmldsig.DIGEST_SHA256
250+
)
251251
# pysaml needs a string otherwise: "cannot serialize True (type bool)"
252252
if getattr(conf, '_sp_force_authn', False):
253253
sso_kwargs['force_authn'] = "true"

0 commit comments

Comments
 (0)