summaryrefslogtreecommitdiff
path: root/src/saml2/response.py
diff options
context:
space:
mode:
authorHans Hörberg <hans.horberg@umu.se>2015-03-02 11:33:15 +0100
committerHans Hörberg <hans.horberg@umu.se>2015-03-02 11:33:15 +0100
commit6bd9acb4fea4426e2e272f59f27be43b4aa161a6 (patch)
treef61fcd121fff8c0fcdb4984cde5c3393c6e54ddb /src/saml2/response.py
parent717cf133e7a2e2d5b46e3d21772fef1bec504650 (diff)
parent0f34abb58e0c4cee4ac2897e982fb1b841584937 (diff)
downloadpysaml2-6bd9acb4fea4426e2e272f59f27be43b4aa161a6.tar.gz
merge
Diffstat (limited to 'src/saml2/response.py')
-rw-r--r--src/saml2/response.py28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/saml2/response.py b/src/saml2/response.py
index 4290448c..4d0da444 100644
--- a/src/saml2/response.py
+++ b/src/saml2/response.py
@@ -1,19 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2010-2011 Umeå University
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
import calendar
import logging
@@ -37,6 +24,7 @@ from saml2.samlp import STATUS_TOO_MANY_RESPONSES
from saml2.samlp import STATUS_UNKNOWN_ATTR_PROFILE
from saml2.samlp import STATUS_UNKNOWN_PRINCIPAL
from saml2.samlp import STATUS_UNSUPPORTED_BINDING
+from saml2.samlp import STATUS_RESPONDER
import xmldsig as ds
import xmlenc as xenc
@@ -171,6 +159,8 @@ class StatusUnknownPrincipal(StatusError):
class StatusUnsupportedBinding(StatusError):
pass
+class StatusResponder(StatusError):
+ pass
STATUSCODE2EXCEPTION = {
STATUS_VERSION_MISMATCH: StatusVersionMismatch,
@@ -193,6 +183,7 @@ STATUSCODE2EXCEPTION = {
STATUS_UNKNOWN_ATTR_PROFILE: StatusUnknownAttrProfile,
STATUS_UNKNOWN_PRINCIPAL: StatusUnknownPrincipal,
STATUS_UNSUPPORTED_BINDING: StatusUnsupportedBinding,
+ STATUS_RESPONDER: StatusResponder,
}
# ---------------------------------------------------------------------------
@@ -541,6 +532,7 @@ class AuthnResponse(StatusResponse):
if optional:
return True
else:
+ logger.error("No AuthnStatement")
raise
authn_statement = self.assertion.authn_statement[0]
@@ -858,9 +850,13 @@ class AuthnResponse(StatusResponse):
"""
try:
- self._verify()
- except AssertionError:
+ res = self._verify()
+ except AssertionError as err:
+ logger.error("Verification error on the response: %s" % err)
raise
+ else:
+ if res is None:
+ return None
if not isinstance(self.response, samlp.Response):
return self
@@ -904,7 +900,7 @@ class AuthnResponse(StatusResponse):
return res
def session_info(self):
- """ Returns a predefined set of information gleened from the
+ """ Returns a predefined set of information gleened from the
response.
:returns: Dictionary with information
"""