Skip to content

Commit 85b03b5

Browse files
committed
Adds support for RequestedAuthnContext SSO kwarg
1 parent 8c7a5e9 commit 85b03b5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

djangosaml2/views.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,21 @@ def get(self, request, *args, **kwargs):
250250

251251
# SSO options
252252
sign_requests = getattr(conf, '_sp_authn_requests_signed', False)
253-
if sign_requests:
253+
if sign_requests:
254254
sso_kwargs["sigalg"] = getattr(conf, '_sp_signing_algorithm',
255255
saml2.xmldsig.SIG_RSA_SHA256
256256
)
257257
sso_kwargs["digest_alg"] = getattr(conf,
258258
'_sp_digest_algorithm',
259259
saml2.xmldsig.DIGEST_SHA256
260260
)
261+
csc = getattr(settings, 'SAML_CONFIG', {}).get(
262+
'service',
263+
{}
264+
).get('sp', None)
265+
if csc:
266+
sso_kwargs['requested_authn_context'] = csc.get('requested_authn_context', None)
267+
261268
# pysaml needs a string otherwise: "cannot serialize True (type bool)"
262269
if getattr(conf, '_sp_force_authn', False):
263270
sso_kwargs['force_authn'] = "true"

0 commit comments

Comments
 (0)