summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2021-03-07 20:39:53 +0200
committerGitHub <noreply@github.com>2021-03-07 20:39:53 +0200
commita0539a2444b93dc8a4989ea0769cd4242a53ec58 (patch)
treebccec4ae6ce92cef929a6cc789afe8e14ba8d33a /src
parent745c5921867f5e9c98f31a250fa98f5dd7c948d7 (diff)
parent072f8142c8cd06a45f3f8bd6e087df7e895b966b (diff)
downloadpysaml2-a0539a2444b93dc8a4989ea0769cd4242a53ec58.tar.gz
Merge pull request #779 from peppelinux/metadata_exp_handler
Raise SAMLError on failure to parse a metadata file
Diffstat (limited to 'src')
-rw-r--r--src/saml2/mdstore.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/saml2/mdstore.py b/src/saml2/mdstore.py
index 96acfa1e..44930773 100644
--- a/src/saml2/mdstore.py
+++ b/src/saml2/mdstore.py
@@ -7,12 +7,12 @@ import os
import sys
from itertools import chain
from warnings import warn as _warn
-
from hashlib import sha1
from os.path import isfile
from os.path import join
import requests
+
import six
from saml2 import md
@@ -24,7 +24,6 @@ from saml2 import SAMLError
from saml2 import BINDING_HTTP_REDIRECT
from saml2 import BINDING_HTTP_POST
from saml2 import BINDING_SOAP
-
from saml2.httpbase import HTTPBase
from saml2.extension.idpdisc import BINDING_DISCO
from saml2.extension.idpdisc import DiscoveryResponse
@@ -612,7 +611,10 @@ class InMemoryMetaData(MetaData):
self.entity[entity_descr.entity_id] = _ent
def parse(self, xmlstr):
- self.entities_descr = md.entities_descriptor_from_string(xmlstr)
+ try:
+ self.entities_descr = md.entities_descriptor_from_string(xmlstr)
+ except Exception as e:
+ raise SAMLError(f'Failed to parse metadata file: {self.filename}') from e
if not self.entities_descr:
self.entity_descr = md.entity_descriptor_from_string(xmlstr)