Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def username(self) -> str:
def password(self) -> str | None:
"""
The password used for authentication.
None in case customer authenticating with certificates
None when the event has no password, e.g. when the user authenticates with an SSH key
"""
return self["password"]
return self.get("password")

@property
def protocol(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ def test_transfer_family_authorizer_event():
assert parsed_event.source_ip == raw_event["sourceIp"]


def test_transfer_family_authorizer_event_without_password():
# GIVEN an authorizer event with no password, as for a user authenticating with an SSH key
raw_event = load_event("transferFamilyAuthorizer.json")
del raw_event["password"]

# WHEN reading the password
# THEN it is None, matching the property's type and the Pydantic model's default
assert TransferFamilyAuthorizer(raw_event).password is None


@pytest.mark.parametrize("home_directory_type", ["LOGICAL", "PATH"])
def test_build_authentication_response_s3(home_directory_type):
# GIVEN a Authorizer response
Expand Down
Loading