summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2021-07-13 13:10:45 +0300
committerIvan Kanakarakis <ivan.kanak@gmail.com>2021-07-13 13:10:45 +0300
commitb4fd7262410ac31a71b56c7a703dc4a961a2372e (patch)
tree8ecb89092dca887ef4c0801b9f310fad183b45bf
parent176d216aed0eff5ae38425641ca9ceedf9c12de2 (diff)
downloadpysaml2-b4fd7262410ac31a71b56c7a703dc4a961a2372e.tar.gz
Refactor saml2.response.Response.authn_info
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
-rw-r--r--src/saml2/response.py32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/saml2/response.py b/src/saml2/response.py
index 21abae9a..5935bee8 100644
--- a/src/saml2/response.py
+++ b/src/saml2/response.py
@@ -1071,23 +1071,27 @@ class AuthnResponse(StatusResponse):
def authn_info(self):
res = []
- for astat in self.assertion.authn_statement:
- context = astat.authn_context
+ for statement in self.assertion.authn_statement:
try:
- authn_instant = astat.authn_instant
+ authn_instant = statement.authn_instant
except AttributeError:
authn_instant = ""
- if context:
- try:
- aclass = context.authn_context_class_ref.text
- except AttributeError:
- aclass = ""
- try:
- authn_auth = [a.text for a in
- context.authenticating_authority]
- except AttributeError:
- authn_auth = []
- res.append((aclass, authn_auth, authn_instant))
+
+ context = statement.authn_context
+ if not context:
+ continue
+
+ try:
+ authn_class = context.authn_context_class_ref.text
+ except AttributeError:
+ authn_class = ""
+
+ try:
+ authn_auth = [a.text for a in context.authenticating_authority]
+ except AttributeError:
+ authn_auth = []
+
+ res.append((authn_class, authn_auth, authn_instant))
return res
def authz_decision_info(self):