-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added utility to generate standalone XML SP metadata
- Loading branch information
Dolsy Smith
committed
Apr 21, 2021
1 parent
b4138cf
commit bc4da2c
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |