summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2022-05-27 01:03:59 +0200
committerIvan Kanakarakis <ivan.kanak@gmail.com>2022-05-27 01:03:59 +0200
commitccef0aa78fa0c5ae484ea3737a3d72c0616e7d8c (patch)
treee48f213961eceecd985d230516b961f6734e1bf8
parent92445ac5daa55698f0ca6353dbbdd498b517d8bc (diff)
downloadpysaml2-ccef0aa78fa0c5ae484ea3737a3d72c0616e7d8c.tar.gz
Fix authn_class fallback from authn_context_class_ref to authn_context_decl_ref
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
-rw-r--r--src/saml2/response.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/saml2/response.py b/src/saml2/response.py
index 432fe5de..2c0ef758 100644
--- a/src/saml2/response.py
+++ b/src/saml2/response.py
@@ -1083,13 +1083,11 @@ class AuthnResponse(StatusResponse):
if not context:
continue
- try:
- authn_class = (
- context.authn_context_class_ref.text
- or context.authn_context_decl_ref.text
- )
- except AttributeError:
- authn_class = ""
+ authn_class = (
+ getattr(context.authn_context_class_ref, "text", None)
+ or getattr(context.authn_context_decl_ref, "text", None)
+ or ""
+ )
authenticating_authorities = getattr(
context, "authenticating_authority", []