Bay Valley Tech API
Bay Valley Tech API
Part I
Problem We Are Trying to Solve
Authentication remains to be a cornerstone of digital security, yet many applications and
organizations struggle with the complexities of implementing and managing a secure
authentication platform. Ensuring compatibility across multiple applications and platforms
poses a significant challenge. There is a pressing need for a comprehensive authentication
backend solution that streamlines the authentication process, offering a seamless, secure, and
adaptable solution for applications.
Solution Summary
Create an incredibly simple BaaS offering with a focus on authentication to integrate with all
other Bay Valley Tech projects.
23-29-LS-PRD-1-A
Part II
Functional Requirements
1. This API must accept REST web requests.
2. This API must be hosted on AWS EC2.
g. `staff_flag`
i. A boolean value.
1. `true` if the user is Bay Valley Tech staff.
h. `disable_login_flag`
4. Create a `mfa_code` table, with the following columns:
a. `user_id`
b. `mfa_code`
i. The code sent to the user for MFA.
c. `used_flag`
i. A boolean value.
1. `true` if the MFA code has been consumed by the API.
d. `expiration_date`
i. A datetime value, used to determine if the MFA code has expired.
5. Create `refresh_token` table, with the following columns:
a. `user_id`
b. `token`
i. The refresh token itself.
c. `expiration_date`
i. A datetime value, used to determine if the refresh token has expired.
6. The web API must run on Node, version 18 or greater.
7. Each table should have an `id` column as the primary key of the table.
8. Each table should have an `insert_date` that stores the date and time that a record was
inserted.
9. Each table should have an `insert_user_id` that stores what user inserted a record.
10. Each table should have an `update_date` that stores the date and time that a record
was updated.
11. Each table should have an `update_user_id` that stores what user updated a record.
12. All table and column names should use snake case, i.e., `insert_date`, `insert_user_id`,
etc.
13. All columns must have a comment describing what data that column will store.
14. Create a login API endpoint.
a. URL: /api/auth/login
b. Method: POST
c. Request body:
i. `emailAddress`
1. Required
ii. `password`
1. Required
d. Response payload:
i. If the user does not have MFA enabled:
1. `jwt`
2. `refreshToken`
ii. If the user has MFA enabled, then send an MFA code.
e. Notes:
23-29-LS-PRD-1-A
b. Method: POST
c. Request body:
i. `emailAddress`
ii. `token`
d. Response payload:
i. None
e. Notes:
i. Ensure that any applicable audit records are logged.
f. Security considerations:
i. Ensure that the user is notified that the password associated with their
account has been reset.
18. Create an API endpoint that fetches the logged-in user.
a. This is a protected endpoint; a JWT is required to determine who the user is.
b. URL: /api/auth/self
c. Method: GET
d. Request body:
i. None
e. Response payload:
i. `first_name`
ii. `last_name`
iii. `email_address`
iv. `mobile_phone_number`
v. `mfa_method`
vi. `staff_flag`
vii. `disable_login_flag`
f. Notes:
i. Ensure that any applicable audit records are logged.
g. Security considerations:
i. None
19. Create an API endpoint that updates the logged-in user.
a. This is a protected endpoint; a JWT is required to determine who the user is.
b. URL: /api/auth/self
c. Method: PUT
d. Request body:
i. `first_name`
ii. `last_name`
iii. `email_address`
iv. `mobile_phone_number`
v. `mfa_method`
vi. `staff_flag`
vii. `disable_login_flag`
e. Response payload:
i. None
f. Notes:
23-29-LS-PRD-1-A
Key Assumptions
• Deploying the API to AWS EC2 assumes that Taylor will be available to help with that
process.
23-29-LS-PRD-1-A
Scope Prioritization
Item MVP MCP Future Constraint/Description
.NET SDK x
Rust SDK x
RBAC x
Multitenancy and customer All users stored in the database for this
isolation project are assumed to be users of a Bay
x Valley Tech tenant. Multitenancy will
allow multiple applications to integrate
with this API.
23-29-LS-PRD-1-A
Wireframes
None.