Skip to content

Commit fdb8522

Browse files
fix: Data manipulation issues in saml_credentials_provider (#57)
* issue-55 * issue-56 * fix: whitespace issue * fix: list manipulation
1 parent f1eab6a commit fdb8522

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

redshift_connector/plugin/saml_credentials_provider.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def refresh(self: "SamlCredentialsProvider") -> None:
100100
role: str = ""
101101
provider: str = ""
102102
for arn in arns:
103+
arn = arn.strip() # remove trailing or leading whitespace
103104
if role_pattern.match(arn):
104105
role = arn
105106
if provider_pattern.match(arn):
@@ -212,7 +213,7 @@ def read_metadata(self: "SamlCredentialsProvider", doc: bytes) -> CredentialsHol
212213
for attr in attrs:
213214
name: str = attr.attrs["Name"]
214215
values: typing.Any = attr.findAll("{}AttributeValue".format(SAML_RESP_NAMESPACES[namespace_used_idx]))
215-
if len(values) == 0:
216+
if len(values) == 0 or not values[0].contents:
216217
# Ignore empty-valued attributes.
217218
continue
218219
value: str = values[0].contents[0]

0 commit comments

Comments
 (0)