Skip to content

Commit 5ee0407

Browse files
committed
Adds support for RequestedAuthnContext SSO kwarg
1 parent 02f4a19 commit 5ee0407

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

djangosaml2/views.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,21 @@ def get(self, request, *args, **kwargs):
249249

250250
# SSO options
251251
sign_requests = getattr(conf, '_sp_authn_requests_signed', False)
252-
253-
if sign_requests:
254-
csc = settings.SAML_CONFIG['service']['sp']
255-
sso_kwargs["sigalg"] = csc.get('signing_algorithm',
256-
saml2.xmldsig.SIG_RSA_SHA256)
257-
sso_kwargs["digest_alg"] = csc.get('digest_algorithm',
258-
saml2.xmldsig.DIGEST_SHA256)
252+
sso_kwargs['requested_authn_context'] = getattr(
253+
conf,
254+
'_sp_requested_authn_context',
255+
None
256+
)
257+
csc = settings.SAML_CONFIG.get(
258+
'service',
259+
None
260+
).get('sp', None)
261+
if csc:
262+
if sign_requests and csc:
263+
sso_kwargs["sigalg"] = csc.get('signing_algorithm',
264+
saml2.xmldsig.SIG_RSA_SHA256)
265+
sso_kwargs["digest_alg"] = csc.get('digest_algorithm',
266+
saml2.xmldsig.DIGEST_SHA256)
259267

260268
# pysaml needs a string otherwise: "cannot serialize True (type bool)"
261269
if getattr(conf, '_sp_force_authn', False):

0 commit comments

Comments
 (0)