Skip to content

Commit 17f4daf

Browse files
committed
Load the encryption template using package resources
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
1 parent bdc3707 commit 17f4daf

File tree

5 files changed

+4
-2
lines changed

5 files changed

+4
-2
lines changed

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ install_requires =
5353
pytz
5454
requests >= 1.0.0
5555
six
56+
importlib_resources
5657

5758

5859
[options.packages.find]

src/saml2/data/__init__.py

Whitespace-only changes.

src/saml2/data/templates/__init__.py

Whitespace-only changes.

src/saml2/sigver.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import saml2.cryptography.asymmetric
2525
import saml2.cryptography.pki
2626
import saml2.xmldsig as ds
27+
import saml2.data.templates as _data_template
2728
from saml2 import samlp
2829
from saml2 import SamlBase
2930
from saml2 import SAMLError
@@ -1288,8 +1289,8 @@ def __init__(
12881289
self.only_use_keys_in_metadata = only_use_keys_in_metadata
12891290

12901291
if not template:
1291-
this_dir, this_filename = os.path.split(__file__)
1292-
self.template = os.path.join(this_dir, 'xml_template', 'template.xml')
1292+
with _resource_path(_data_template, "template_enc.xml") as fp:
1293+
self.template = str(fp)
12931294
else:
12941295
self.template = template
12951296

0 commit comments

Comments
 (0)