'Set headers for requests to Front End after login with Cognito

I need to implement a web application authentication and authorization system on AWS and I am not sure how one of the required steps can be implemented.

I have a web application deployed on EC2 instances and I have an ALB ahead that implements cognito authentication. The web application requires a series of headers in the request with a series of attributes of the logged in user.

What I need to implement is that, once the user is logged in, a component makes a query against a database, retrieves the value of some attributes of the user and sets them in request headers so that they reach the web application.

How could you implement this pattern on AWS?

All the best,



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source