From ccef0aa78fa0c5ae484ea3737a3d72c0616e7d8c Mon Sep 17 00:00:00 2001 From: Ivan Kanakarakis Date: Fri, 27 May 2022 01:03:59 +0200 Subject: Fix authn_class fallback from authn_context_class_ref to authn_context_decl_ref Signed-off-by: Ivan Kanakarakis --- src/saml2/response.py | 12 +++++------- 1 file 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", [] -- cgit v1.2.1