Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are creating a notebook application. Your task is to implement the AWS Lambda function that will perform basic authentication and return the notes of

You are creating a notebook application. Your task is to implement the AWS Lambda function that will perform basic authentication and return the notes of the authenticated user. The notes and authentication data are stored in DynamoDB tables. The lambda function is later exposed through the API Gateway and serves as an HTTP request handler. Runtime for this Lambda handler is Java 8. Notes The DynamoDB table holding notes is named user-notes. Each note has the following attributes: -\(1 d \), which is a UUID V4; - user, which is an owner's email; - create date, which is a creation date, stored as a string in ISO_8601 format; - text, which holds actual note content. Example table rows: Database keys and indexes The table consists of a Partition key (user) and a Sort key (create_date). Authentication /r/n The DynamoDB table holding the authentication data is named token-ema1l-1ookup. The table has two fields: token and email. Each authentication token maps to the email of the user owning the given token. The table has a Partition key on the token field. Example table rows: Authentication header Tokens are passed to the lambda through the Authentication HTTP request header. The headers are available in the event. headers object. The Authentication header value takes the Bearer STOKEN> format. To query the user-notes table with the user email, you should get it from token-email-1ookup ones, reading the token from the HTTP request. Requirements /r/n Your task is to finish the implementation of the given lambda function. The function should: - return the user notes sorted by the create date attribute (in descending order),- return a maximum of 10 notes per query, - return an error (status 403) if token is invalid or empty (Bearer),- return an error (status 400) if the Authentication header is malformed or missing. You can focus on retuming the notes first and sort them later; the operations are scored separately. Technical notes Please note that handleRequest and getAuthenticateduserEmail functions are hooked with a testing framework. Don't change their names and signatures. Of course, you can add new functions. For querying DynamoDB please use specified table objects (eg. Table table \(=\) DynamoDBClient client getTable(tableName) :). You can look up their definitions in the official AWS Java DynamoDB SDK documentation.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the value gap?

Answered: 1 week ago

Question

6. Identify seven types of hidden histories.

Answered: 1 week ago

Question

What is the relationship between humans and nature?

Answered: 1 week ago