Skip to content

Bug: Dataclass - TransferFamilyAuthorizerResponse - Wrong response build for HomeDirectoryDetails #6396

Closed
@fabien-github

Description

@fabien-github

Expected Behaviour

Generate correct response with _build_authentication_response() method when using HomeDirectoryDetails.

Current Behaviour

When using : _build_authentication_response() method to build a response to AWS Transfer Server with a custom lambda identity provider, AWS required a string representation of a JSON map for the HomeDirectoryDetails value.

Currently; we return a list of dict.

Second, the value can be a list of mapping, as we can see in the python lambda example in the documentation.


From : https://docs.aws.amazon.com/transfer/latest/userguide/custom-lambda-idp.html

HomeDirectoryDetails is a string representation of a JSON map. This is in contrast to PosixProfile, which is an actual JSON map object, and PublicKeys which is a JSON array of strings. See the code examples for the language-specific details.

Code snippet

Can't reproduce without a running AWS Transfer Server, the server return "Unable to parse Json" when the HomeDirectoryDetails is not correcly formated.

Possible Solution

response["HomeDirectoryDetails"] = [home_directory_details]

Solution :

response["HomeDirectoryDetails"] = json.dumps([home_directory_details]) 

Steps to Reproduce

Hard to do, you need to setup a full AWS Transfert Server with lambda authorizer and return a response builded with the data class.

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.12

Packaging format used

Lambda Layers, PyPi, Serverless Application Repository (SAR) App

Debugging logs

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingevent_sourcesEvent Source Data Class utility

Type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions