summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeppelinux <giuseppe.demarco@unical.it>2021-01-24 01:04:04 +0100
committerpeppelinux <giuseppe.demarco@unical.it>2021-01-24 01:11:38 +0100
commite2ed1b0db99530992fa7b6b8ae15a6f79f11c147 (patch)
tree5ddfb864a05a3cb8902d3f9cc2eef1d1e199c876
parent7f1119737838ad0e9cf0c2e8ac2d34f9d66a1ab9 (diff)
downloadpysaml2-e2ed1b0db99530992fa7b6b8ae15a6f79f11c147.tar.gz
Invalid Destination URL Exception Handling
-rw-r--r--src/saml2/response.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/saml2/response.py b/src/saml2/response.py
index 50e4f6b0..d8a43bfe 100644
--- a/src/saml2/response.py
+++ b/src/saml2/response.py
@@ -94,6 +94,9 @@ class StatusAuthnFailed(StatusError):
class StatusInvalidAttrNameOrValue(StatusError):
pass
+class StatusInvalidAuthnResponseStatement(StatusError):
+ pass
+
class StatusInvalidNameidPolicy(StatusError):
pass
@@ -1099,13 +1102,17 @@ class AuthnResponse(StatusResponse):
return {"name_id": self.name_id, "came_from": self.came_from,
"issuer": self.issuer(), "not_on_or_after": nooa,
"authz_decision_info": self.authz_decision_info()}
- else:
+ elif getattr(self.assertion, 'authn_statement', None):
authn_statement = self.assertion.authn_statement[0]
return {"ava": self.ava, "name_id": self.name_id,
"came_from": self.came_from, "issuer": self.issuer(),
"not_on_or_after": nooa, "authn_info": self.authn_info(),
"session_index": authn_statement.session_index}
-
+ else:
+ raise StatusInvalidAuthnResponseStatement(
+ "The Authn Response Statement is not valid"
+ )
+
def __str__(self):
return self.xmlstr