Skip to content

Commit

Permalink
Added utility to generate standalone XML SP metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Dolsy Smith committed Apr 21, 2021
1 parent b4138cf commit bc4da2c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions generate_saml_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os
from onelogin.saml2.settings import OneLogin_Saml2_Settings

saml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'saml')

def get_metadata():
settings = OneLogin_Saml2_Settings(custom_base_path=saml_path)
metadata = settings.get_sp_metadata()
errors = settings.validate_metadata(metadata)
if len(errors) == 0:
return metadata
else:
print(errors)

def save_metadata():
metadata = get_metadata()
if metadata:
with open(saml_path + '/orcid-integration-metadata.xml', 'wb') as f:
f.write(metadata)

if __name__ == '__main__':
save_metadata()

0 comments on commit bc4da2c

Please sign in to comment.