Admin - change XML2Dict namespace separator (#4905)

This commit is contained in:
Bert Blommers 2022-03-03 10:51:00 -01:00 committed by GitHub
parent 7e88a901d9
commit cc2f8c2012
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,22 +102,23 @@ class STSBackend(BaseBackend):
force_cdata=True, force_cdata=True,
process_namespaces=True, process_namespaces=True,
namespaces=namespaces, namespaces=namespaces,
namespace_separator="|",
) )
saml_assertion_attributes = saml_assertion["samlp:Response"]["saml:Assertion"][ saml_assertion_attributes = saml_assertion["samlp|Response"]["saml|Assertion"][
"saml:AttributeStatement" "saml|AttributeStatement"
]["saml:Attribute"] ]["saml|Attribute"]
for attribute in saml_assertion_attributes: for attribute in saml_assertion_attributes:
if ( if (
attribute["@Name"] attribute["@Name"]
== "https://aws.amazon.com/SAML/Attributes/RoleSessionName" == "https://aws.amazon.com/SAML/Attributes/RoleSessionName"
): ):
kwargs["role_session_name"] = attribute["saml:AttributeValue"]["#text"] kwargs["role_session_name"] = attribute["saml|AttributeValue"]["#text"]
if ( if (
attribute["@Name"] attribute["@Name"]
== "https://aws.amazon.com/SAML/Attributes/SessionDuration" == "https://aws.amazon.com/SAML/Attributes/SessionDuration"
): ):
kwargs["duration"] = int(attribute["saml:AttributeValue"]["#text"]) kwargs["duration"] = int(attribute["saml|AttributeValue"]["#text"])
if "duration" not in kwargs: if "duration" not in kwargs:
kwargs["duration"] = DEFAULT_STS_SESSION_DURATION kwargs["duration"] = DEFAULT_STS_SESSION_DURATION