Skip to content

Grupo-G03-4SOAT-FIAP/rms-cognito-triggers

Repository files navigation

rms-cognito-triggers

A set of Lambda triggers to customize Amazon Cognito authentication actions in the RMS project. Lambda triggers allow you to customize how you register and confirm users, authenticate users, send messages, and generate tokens.

SAM Validate and Build SAM Deploy Quality Gate Status Coverage

AWS LAMBDA NodeJS TypeScript

Tip

O Amazon Cognito trabalha com funções do AWS Lambda para modificar o comportamento da autenticação. As funções Lambda podem modificar o comportamento padrão do fluxo de autenticação, como permitir login "passwordless" sem senha por exemplo.
Para mais informações sobre os Lambda Triggers do Amazon Cognito visiste a página Como personalizar fluxos de trabalho do grupo de usuários com acionadores do Lambda.

Pré-requisitos

Você deve ter instalado a AWS CLI, o AWS SAM CLI e possuir uma conta na AWS.

Deploy the sample application

To build and deploy your application for the first time, run the following in your shell:

sam build
sam deploy --guided

Use the SAM CLI to build and test locally

Build your application with the sam build command.

rms-cognito-triggers$ sam build

The SAM CLI installs dependencies defined in <function-name>/package.json, compiles TypeScript with esbuild, creates a deployment package, and saves it in the .aws-sam/build folder.

Test a single function by invoking it directly with a test event. An event is a JSON document that represents the input that the function receives from the event source. Test events are included in the events folder in this project.

Run functions locally and invoke them with the sam local invoke command.

rms-cognito-triggers$ sam local invoke HelloWorldFunction --event events/event.json

The SAM CLI can also emulate your application's API. Use the sam local start-api to run the API locally on port 3000.

rms-cognito-triggers$ sam local start-api
rms-cognito-triggers$ curl http://localhost:3000/

Unit tests

Tests are defined in the <function-name>/tests folder in this project. Use NPM to install the Jest test framework and run unit tests.

rms-cognito-triggers$ cd function-name
function-name$ npm install
function-name$ npm run test

Cleanup

To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following:

sam delete --stack-name rms-cognito-triggers

Métricas de código

Quality Gate Status Technical Debt Coverage Lines of Code Code Smells Maintainability Rating Security Rating Bugs Vulnerabilities Duplicated Lines (%) Reliability Rating

Projetos relacionados

API de Pedidos
https://github.com/Grupo-G03-4SOAT-FIAP/rms-api-pedidos

Infrastructure as code (IaC) com Terraform
https://github.com/Grupo-G03-4SOAT-FIAP/rms-iac

Requisitos

aws-cli/2.15.10, AWS SAM CLI version 1.110.0 e Node.js 20.x

SonarCloud