This repository contains the implementation of the Enterprise Architecture Workshop: Secure Application Design lab using two decoupled servers on AWS:
- Server 1 (Apache): serves the asynchronous web client (HTML + CSS + JavaScript).
- Server 2 (Spring Boot): exposes REST services for user registration and authentication.
The objective was to build a security-focused solution: TLS usage, secure client-server communication, and hashed credential handling.
- Web Client (Apache):
- Registration and login forms.
- Asynchronous backend API consumption (
fetch).
- Spring Boot Backend (REST API):
- Endpoints
/usersand/users/login. - Password hashing logic with SHA-256.
- MongoDB persistence.
- Endpoints
- AWS Infrastructure (EC2):
- Instance for Apache.
- Instance for Spring Boot.
flowchart LR
U[Browser User] -->|HTTPS 443| A[EC2 Apache\nHTML/CSS/JS Client]
A -->|HTTPS 443 / API REST| S[EC2 Spring Boot\n/users, /users/login]
S --> M[(MongoDB)]
- TLS was configured for:
- Client download from Apache.
- REST API exposure in Spring Boot.
- Certificates were used to protect traffic confidentiality and integrity.
- In the user service, passwords are not stored in plain text.
- Deterministic SHA-256 hashing is applied before persistence.
- During login, the hash is computed again and compared against the stored value.
Apache/
index.html
styles.css
script.js
Spring/
pom.xml
src/main/java/... (controllers, service, model, repository)
src/main/resources/application.properties
images/
(deployment, TLS, and testing evidence)
- Create an EC2 instance for Apache.
- Install and enable Apache (
httpd). - Copy files from
Apache/to the public directory (/var/www/html). - Open ports 80 and 443 in the Security Group.
- Generate/install TLS certificate (Let's Encrypt + Certbot).
- Validate HTTPS access to the frontend.

- Create an EC2 instance for Spring.
- Install Java 17 and Maven.
- Clone the repository and enter the
Spring/directory. - Define minimum environment variables:
SERVER_PORTMONGODB_URISSL_ENABLEDSSL_KEY_STORE,SSL_KEY_STORE_PASSWORD,SSL_KEY_ALIAS
- Package and run:
mvn clean packagejava -jar target/SecureSpring2-1.0-SNAPSHOT.jar
- Open required ports (443 and/or configured port) in the Security Group.
- Validate REST endpoints over HTTPS.

- Spring is prepared for TLS via
application.properties:server.ssl.enabledserver.ssl.key-store-type=PKCS12server.ssl.key-storeserver.ssl.key-store-passwordserver.ssl.key-alias
- The backend can run SSL with a
.p12keystore.
- POST
/users - Body JSON:
{
"email": "usuario@correo.com",
"password": "clave123"
}- Expected responses:
201 Created: user created.409 Conflict: user already exists.
- POST
/users/login - Body JSON:
{
"email": "usuario@correo.com",
"password": "clave123"
}- Expected responses:
200 OK: successful authentication.401 Unauthorized: invalid credentials.
- Decoupled architecture (frontend/backend on independent servers).
- TLS encryption implementation for secure transport.
- Password persistence with hash (without plain-text storage).
- Asynchronous client to improve user experience and response times.
- Separating frontend and backend makes it easier to scale each layer horizontally.
- Using environment variables enables secure per-environment configuration.






