Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow MDQ "entity_transform": "percent_encoded" #959

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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