Search code examples
amazon-web-servicesspring-bootlambda-authorizer

How to get custom context information added by lambda authorizer in spring boot container? AWS Apigateway HTTP API


We are using AWS ECS service run a container, we are running spring boot application in that container. This is exposed using AWS Apigateway HTTP API. This AWS Apigateway HTTP API is secured using lambda authorizer. Now I want to add some information to each request in lambda authorizer and I want to access that information in spring boot application method. How can I do that?


Solution

  • enter image description here

    We have to set context field to an object(key-value pair) in lambda authorizer's response.

    Then, we have to set parameter mapping as shown in the image. After that we can use Balu Vyamajala's code to get those values in spring boot controller's methods.