diff options
author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2021-01-07 19:13:20 +0200 |
---|---|---|
committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2021-01-07 19:30:35 +0200 |
commit | 17f4daf48fdd36b6fcd1ad30e7641d6845b94202 (patch) | |
tree | ad2ae846f0700bcb9adfe99563d6f599e478f916 | |
parent | bdc3707f2dba5b617959ccdd6d9b1633bce9577d (diff) | |
download | pysaml2-17f4daf48fdd36b6fcd1ad30e7641d6845b94202.tar.gz |
Load the encryption template using package resources
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
-rw-r--r-- | setup.cfg | 1 | ||||
-rw-r--r-- | src/saml2/data/__init__.py | 0 | ||||
-rw-r--r-- | src/saml2/data/templates/__init__.py | 0 | ||||
-rw-r--r-- | src/saml2/data/templates/template_enc.xml (renamed from src/saml2/xml_template/template.xml) | 0 | ||||
-rw-r--r-- | src/saml2/sigver.py | 5 |
5 files changed, 4 insertions, 2 deletions
@@ -53,6 +53,7 @@ install_requires = pytz requests >= 1.0.0 six + importlib_resources [options.packages.find] diff --git a/src/saml2/data/__init__.py b/src/saml2/data/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/saml2/data/__init__.py diff --git a/src/saml2/data/templates/__init__.py b/src/saml2/data/templates/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/saml2/data/templates/__init__.py diff --git a/src/saml2/xml_template/template.xml b/src/saml2/data/templates/template_enc.xml index 0b962e55..0b962e55 100644 --- a/src/saml2/xml_template/template.xml +++ b/src/saml2/data/templates/template_enc.xml diff --git a/src/saml2/sigver.py b/src/saml2/sigver.py index 15c3ebee..0e8f1942 100644 --- a/src/saml2/sigver.py +++ b/src/saml2/sigver.py @@ -24,6 +24,7 @@ from six.moves.urllib import parse import saml2.cryptography.asymmetric import saml2.cryptography.pki import saml2.xmldsig as ds +import saml2.data.templates as _data_template from saml2 import samlp from saml2 import SamlBase from saml2 import SAMLError @@ -1288,8 +1289,8 @@ class SecurityContext(object): self.only_use_keys_in_metadata = only_use_keys_in_metadata if not template: - this_dir, this_filename = os.path.split(__file__) - self.template = os.path.join(this_dir, 'xml_template', 'template.xml') + with _resource_path(_data_template, "template_enc.xml") as fp: + self.template = str(fp) else: self.template = template |