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

Fix metadata file creation #53

Merged
merged 1 commit into from
Feb 15, 2024
Merged
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
8 changes: 4 additions & 4 deletions digid_eherkenning/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,20 +181,20 @@ class Meta:
def __str__(self):
return force_str(self._meta.verbose_name)

def populate_xml_fields(self, urls: dict[str, str], xml: str) -> None:
def populate_xml_fields(self, urls: dict[str, str], xml: bytes) -> None:
"""
Populates the idp_metadata_file and idp_service_entity_id fields based on the
fetched xml metadata
"""
self.idp_service_entity_id = urls["entityId"]
content = ContentFile(xml.encode("utf-8"))
content = ContentFile(xml)
self.idp_metadata_file.save("metadata.xml", content, save=False)

def process_metadata_from_xml_source(self) -> tuple[dict[str, str], str]:
def process_metadata_from_xml_source(self) -> tuple[dict[str, str], bytes]:
"""
Parses the xml metadata

:return a tuple of a dictionary with the useful urls and the xml string itself.
:return a tuple of a dictionary with the useful urls and the xml bytes.
"""
try:
xml = OneLogin_Saml2_IdPMetadataParser.get_metadata(
Expand Down
Loading