Skip to content

Commit

Permalink
Admin - change XML2Dict namespace separator (#4905)
Browse files Browse the repository at this point in the history
  • Loading branch information
bblommers committed Mar 3, 2022
1 parent 7e88a90 commit cc2f8c2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions moto/sts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,23 @@ def assume_role_with_saml(self, **kwargs):
force_cdata=True,
process_namespaces=True,
namespaces=namespaces,
namespace_separator="|",
)

saml_assertion_attributes = saml_assertion["samlp:Response"]["saml:Assertion"][
"saml:AttributeStatement"
]["saml:Attribute"]
saml_assertion_attributes = saml_assertion["samlp|Response"]["saml|Assertion"][
"saml|AttributeStatement"
]["saml|Attribute"]
for attribute in saml_assertion_attributes:
if (
attribute["@Name"]
== "https://aws.amazon.com/SAML/Attributes/RoleSessionName"
):
kwargs["role_session_name"] = attribute["saml:AttributeValue"]["#text"]
kwargs["role_session_name"] = attribute["saml|AttributeValue"]["#text"]
if (
attribute["@Name"]
== "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:
kwargs["duration"] = DEFAULT_STS_SESSION_DURATION
Expand Down

0 comments on commit cc2f8c2

Please sign in to comment.