Nirmal
Nirmal

Reputation: 61

Pass AWS authorizer policy context values to .net 6 minimal api

I have a scenario where I need to send custom headers from the API gateway after successfully authorized using lambda authorizer.

From the authorizer, I will be sending the JSON policy return with the context JSON key-value pair as below.

{
  "principalId": "xxxxxxxxxx",
  "policyDocument": {
    "Version": "2012-10-17",
    "Statement": [
      {
        "Action": "execute-api:Invoke",
        "Effect": "Allow",
        "Resource": "*"
      }
    ]
  },
  "context": {
    "company_id": "xxxxx-xxx-xxxxxx",
    "Owner":"xxxxx",
  }
}

My question is, now I need to pass the context key-value pair as custom headers to the minimal API from the API gateway.

Can you please suggest to me how to achieve this, since I am started learning AWS a month ago and working on the same? It will be helpful if I get some suggestions from the people who worked on these scenarios before.

Note : Lambda function is deployed with .net 6 minimal API and API gateway resources call the deployed lambda

Api gateway resources are lambda proxy enabled in the lambda integration part.

Upvotes: 2

Views: 138

Answers (0)

Related Questions