-
Couldn't load subscription status.
- Fork 447
Register common namespace prefixes #625
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
Conversation
as @spaceone already proposed here: IdentityPython#326
2be14b0 to
806f4fa
Compare
Codecov Report
@@ Coverage Diff @@ ## master #625 +/- ## ========================================= Coverage ? 65.42% ========================================= Files ? 103 Lines ? 25724 Branches ? 0 ========================================= Hits ? 16831 Misses ? 8893 Partials ? 0
Continue to review full report at Codecov.
|
e82ef71 to
8b1bb93
Compare
...l2.__init__ - code cleanup - SamlBase.register_prefix is now a staticmethod
I'd also like to discuss the opportunity to merge some constants.
These was found as duplicate in the source tree, we can merge them into saml2.init or whatever then import from it if you agree.
In metadata.py
At line 35
NSPAIR = {
"saml2p": "urn:oasis:names:tc:SAML:2.0:protocol",
"saml2": "urn:oasis:names:tc:SAML:2.0:assertion",
"soap11": "http://schemas.xmlsoap.org/soap/envelope/",
"meta": "urn:oasis:names:tc:SAML:2.0:metadata",
"xsi": "http://www.w3.org/2001/XMLSchema-instance",
"ds": "http://www.w3.org/2000/09/xmldsig#",
"shibmd": "urn:mace:shibboleth:metadata:1.0",
"md": "urn:oasis:names:tc:SAML:2.0:metadata",
}
XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance'
./validate.py:10:XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance'
./saml.py:23:XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance'
./init.py:53:XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance'
NAMESPACE = 'urn:oasis:names:tc:SAML:2.0:assertion'
./saml.py:21:NAMESPACE = 'urn:oasis:names:tc:SAML:2.0:assertion'
./metadata.py:37: "saml2": "urn:oasis:names:tc:SAML:2.0:assertion",
./sigver.py:209:NODE_NAME = 'urn:oasis:names:tc:SAML:2.0:assertion:Assertion'
./sigver.py:210:ENC_NODE_NAME = 'urn:oasis:names:tc:SAML:2.0:assertion:EncryptedAssertion'
./init.py:50:NAMESPACE = 'urn:oasis:names:tc:SAML:2.0:assertion'
(XS|XSI)_NAMESPACE = 'http://www.w3.org/2001/XMLSchema(-instance)'
./validate.py:10:XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance'
./saml.py:23:XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance'
./saml.py:24:XS_NAMESPACE = 'http://www.w3.org/2001/XMLSchema'
./init.py:53:XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance'
./init.py:54:XS_NAMESPACE = 'http://www.w3.org/2001/XMLSchema'
MD_NAMESPACE = "urn:oasis:names:tc:SAML:2.0:metadata"
./metadata.py:39: "meta": "urn:oasis:names:tc:SAML:2.0:metadata",
./metadata.py:43: "md": "urn:oasis:names:tc:SAML:2.0:metadata",
./metadata.py:59:MDNS = '"urn:oasis:names:tc:SAML:2.0:metadata"'
./metadata.py:60:bMDNS = b'"urn:oasis:names:tc:SAML:2.0:metadata"'
./init.py:55:MD_NAMESPACE = "urn:oasis:names:tc:SAML:2.0:metadata"
./md.py:13:NAMESPACE = 'urn:oasis:names:tc:SAML:2.0:metadata'
MDUI_NAMESPACE = "urn:oasis:names:tc:SAML:metadata:ui"
./extension/ui.py:12:NAMESPACE = 'urn:oasis:names:tc:SAML:metadata:ui'
./init.py:56:MDUI_NAMESPACE = "urn:oasis:names:tc:SAML:metadata:ui"
DS_NAMESPACE = 'http://www.w3.org/2000/09/xmldsig#'
./metadata.py:41: "ds": "http://www.w3.org/2000/09/xmldsig#",
./init.py:57:DS_NAMESPACE = 'http://www.w3.org/2000/09/xmldsig#'
./xmldsig/init.py:10:NAMESPACE = 'http://www.w3.org/2000/09/xmldsig#'
XENC_NAMESPACE = "http://www.w3.org/2001/04/xmlenc#"
./init.py:58:XENC_NAMESPACE = "http://www.w3.org/2001/04/xmlenc#"
./xmlenc/init.py:11:NAMESPACE = 'http://www.w3.org/2001/04/xmlenc#'
[not duplicated] ALG_NAMESPACE = "urn:oasis:names:tc:SAML:metadata:algsupport"
./init.py:59:ALG_NAMESPACE = "urn:oasis:names:tc:SAML:metadata:algsupport"
MDATTR_NAMESPACE = "urn:oasis:names:tc:SAML:metadata:attribute"
./extension/mdattr.py:12:NAMESPACE = 'urn:oasis:names:tc:SAML:metadata:attribute'
./init.py:60:MDATTR_NAMESPACE = "urn:oasis:names:tc:SAML:metadata:attribute"
alekratz
commented
Apr 5, 2022
Is this going to get merged? I've been using the code from this PR for a few years now and it's making my devops pipeline, um, difficult.
rebased #326
kushaldas
commented
Aug 7, 2024
Commenting so that it shows up to the maintainers.
Uh oh!
There was an error while loading. Please reload this page.
as @spaceone has already proposed here: #326
This PR makes pySAML2 to adopt OASIS conventions about namespace prefixes.
USAGE
A user can registers his own prefixes defining them into a dict and registering them as follow:
@c00kiemon5ter
Even if you do not want to merge this PR as-is I will be very thankfull to you and also to the community if we'll keep
OASIS_DEFAULT_NS_PREFIXESas reference andSamlBase.register_prefixas a staticmethod. This will give us the opportunity to let the users to register OASIS namespaces during configuration, or any other own tastes. They just would then type:Regarding unit test I'll follow @spaceone suggestions, dealing with a dynamic adaptation of xml templates. I know that this PR could represent a risk for legacy systems but I would also found in this an important belonging to OASIS conventions. Hope to meet your line.