Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/saml2/mdstore.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import urllib.parse
import hashlib
from hashlib import sha1
import importlib
Expand Down Expand Up @@ -903,6 +904,10 @@ def sha1_entity_transform(entity_id):
transform = f"{{sha1}}{entity_id_sha1}"
return transform

@staticmethod
def percent_encoded_entity_transform(entity_id):
return urllib.parse.quote(entity_id, safe='')

def __init__(
self,
url=None,
Expand Down Expand Up @@ -932,7 +937,9 @@ def __init__(

self.url = url.rstrip("/")

if entity_transform:
if entity_transform == "percent_encoded":
self.entity_transform = MetaDataMDX.percent_encoded_entity_transform
elif entity_transform:
self.entity_transform = entity_transform
else:
self.entity_transform = MetaDataMDX.sha1_entity_transform
Expand Down