Product Scope and Requirements - Non-Functional Constraints and Quality Expectations

Overview

This section captures the quality-oriented expectations that are visible in the repository’s build, runtime configuration, and test surface. The implementation is centered on a Spring Boot application that starts from src/main/java/com/bankasap/BankAsapApplication.java, uses a local H2-backed runtime by default, sends mail through JavaMailSender, and protects credentials with BCryptPasswordEncoder.

The code and tests express expectations around startup reliability, password handling, email delivery, local developer diagnostics, and repeatable verification. The strongest source-backed signals come from pom.xml, src/main/resources/application.properties, src/main/java/com/bankasap/BankAsapApplication.java, src/test/java/com/bankasap/BankAsapApplicationTests.java, src/test/java/com/bankasap/service/AuthServiceTest.java, and src/test/java/com/bankasap/service/EmailServiceTest.java.

Quality Expectations and Constraint Surface

flowchart LR
    build[pom xml]
    runtime[application properties]
    app[BankAsapApplication]
    auth[AuthService]
    mail[EmailService]
    smoke[BankAsapApplicationTests]
    authTest[AuthServiceTest]
    mailTest[EmailServiceTest]

    build --> app
    runtime --> app
    runtime --> auth
    runtime --> mail
    app --> auth
    app --> mail
    smoke --> app
    authTest --> auth
    mailTest --> mail
Quality expectation Source-backed implementation surface What is enforced or verified
Java and platform baseline pom.xml sets <java.version>25</java.version> and uses spring-boot-starter-parent version 4.0.6 The project is built against a fixed Java release and Spring Boot parent version.
Secure password handling [REDACTED] Password hashing is handled through PasswordEncoder backed by BCrypt.
Mail-based verification pom.xml includes spring-boot-starter-mail; src/main/resources/application.properties configures spring.mail.*; src/main/java/com/bankasap/service/EmailService.java uses JavaMailSender Authentication flows depend on outbound mail delivery for 2FA and lock notifications.
Local persistence and disposable data src/main/resources/application.properties sets spring.datasource.url=jdbc:h2:mem:bankasapdb and spring.jpa.hibernate.ddl-auto=create-drop The default runtime database is in-memory and recreated on startup.
Local diagnostics src/main/resources/application.properties enables spring.h2.console.enabled=true and spring.jpa.show-sql=true Developers get H2 console access and SQL logging during runtime.
Input validation support pom.xml includes spring-boot-starter-validation Validation infrastructure is present for request-bound input handling.
Web runtime support pom.xml includes spring-boot-starter-webmvc The application is packaged as a Spring MVC web application.
Deterministic service verification src/test/java/com/bankasap/service/AuthServiceTest.java and src/test/java/com/bankasap/service/EmailServiceTest.java use Mockito-based unit tests Core authentication and mail behaviors are verified without live infrastructure.
Spring context startup verification src/test/java/com/bankasap/BankAsapApplicationTests.java uses @SpringBootTest and contextLoads() The application context must start successfully in the test environment.
SMTP transport security src/main/resources/application.properties sets spring.mail.properties.mail.smtp.auth=true and spring.mail.properties.mail.smtp.starttls.enable=true SMTP authentication and STARTTLS are enabled for mail transport.

Build and Runtime Surfaces

pom.xml

File path: pom.xml

Surface Source-backed detail
Parent and versioning spring-boot-starter-parent version 4.0.6, project version 0.0.1-SNAPSHOT, Java version 25
Runtime dependencies spring-boot-h2console, spring-boot-starter-data-jpa, spring-boot-starter-validation, spring-boot-starter-webmvc, spring-boot-starter-mail, spring-security-crypto, h2, postgresql, lombok
Test dependencies spring-boot-starter-data-jpa-test, spring-boot-starter-validation-test, spring-boot-starter-webmvc-test
Build plugin behavior spring-boot-maven-plugin excludes lombok; maven-compiler-plugin configures Lombok annotation processing for both compile and testCompile

src/main/resources/application.properties

File path: src/main/resources/application.properties

Key Value or effect Quality implication
spring.application.name BankASAP Provides the application name used at runtime.
spring.datasource.url jdbc:h2:mem:bankasapdb Uses an in-memory database instance named bankasapdb.
spring.datasource.driverClassName org.h2.Driver Aligns the datasource with H2.
spring.datasource.username sa Default local database user.
spring.datasource.password empty No local DB password is configured.
spring.h2.console.enabled true H2 console is available.
spring.h2.console.path /h2-console H2 console path is fixed.
spring.jpa.hibernate.ddl-auto create-drop Schema is recreated on startup and dropped on shutdown.
spring.jpa.show-sql true SQL statements are logged.
spring.mail.host smtp.gmail.com Mail is routed through Gmail SMTP.
spring.mail.port 587 SMTP submission port is fixed.
spring.mail.username redacted Sensitive SMTP credential is stored in the properties file.
spring.mail.password redacted Sensitive SMTP credential is stored in the properties file.
spring.mail.properties.mail.smtp.auth true SMTP authentication is required.
spring.mail.properties.mail.smtp.starttls.enable true STARTTLS is enabled.

src/main/java/com/bankasap/BankAsapApplication.java

File path: src/main/java/com/bankasap/BankAsapApplication.java

Method Quality role
main Starts the Spring application through SpringApplication.run(BankAsapApplication.class, args).
passwordEncoder [REDACTED]

Service Surfaces that Carry the Quality Constraints

AuthService

File path: src/main/java/com/bankasap/service/AuthService.java

Method Quality role
signUp Validates email and password rules, creates a pending sign-up, sends a verification code, and returns a status message.
verifySignUp Confirms the sign-up code before persisting the new User.
resendSignUpCode Refreshes the pending sign-up code and expiry window.
login Checks account lock state, verifies password through PasswordEncoder, increments failed attempts, and triggers 2FA code delivery.
verifyCode Validates the 2FA code and expiry before completing login.
resendCode Sends a replacement 2FA code for an existing user when the account is not locked.

EmailService

File path: src/main/java/com/bankasap/service/EmailService.java

Method Quality role
sendTwoFactorCode Sends the 2FA message used by sign-up and login verification flows.
sendAccountLockedEmail Constructs the lock notification email template.

Verification Surfaces

src/test/java/com/bankasap/BankAsapApplicationTests.java

File path: src/test/java/com/bankasap/BankAsapApplicationTests.java

Test class Verification focus
BankAsapApplicationTests @SpringBootTest plus contextLoads() verifies that the Spring context starts cleanly.

src/test/java/com/bankasap/service/AuthServiceTest.java

File path: src/test/java/com/bankasap/service/AuthServiceTest.java

Test focus Source-backed expectation
Sign-up path Valid credentials return "Signup verification code sent to email", generate a 10-character code, and do not persist a User before verification.
Sign-up verification Correct code returns "User registered successfully" and persists a User whose email and encoded password match the expected values.
Sign-up code resend Resending issues a new 10-character code and returns "New signup verification code sent to email".
Login path A valid password returns "2FA code sent to email" and sends a 10-character code.
2FA verification Correct code returns "Login successful".
2FA resend Resending returns "New 2FA code sent to email" and sends a 10-character code.
Test isolation Mockito-based setup replaces the repository, mail service, and password encoder to keep the checks deterministic.

src/test/java/com/bankasap/service/EmailServiceTest.java

File path: src/test/java/com/bankasap/service/EmailServiceTest.java

Test focus Source-backed expectation
Two-factor mail sendTwoFactorCode targets the provided recipient, uses the subject "Bank ASAP - 2FA Code", and formats the text as "Your Bank ASAP authentication code is: " plus the code.
Lock notification mail sendAccountLockedEmail targets the provided recipient, uses the subject "Bank ASAP - Account Locked", and sets the body to "Your account was locked after 3 failed login attempts."

Operational Expectations

Area Expectation supported by the code
Startup The application must start through BankAsapApplication.main and satisfy contextLoads() in the Spring test.
Persistence lifecycle Data stored in the default H2 database is ephemeral because the datasource is in-memory and the schema is dropped on shutdown.
Authentication Passwords are hashed before storage, and login uses encoded-password matching.
Verification delivery Sign-up and login depend on email delivery of short-lived codes.
Local inspection H2 console access and SQL logging are enabled for the default runtime profile.
Mail transport SMTP authentication and STARTTLS are enabled for the mail channel.

Key Files Reference

Note: AuthService.login sets lockedUntil with LocalDateTime.now().plusSeconds(15) but returns the message "Account locked for 15 minutes". The actual lock window in code is 15 seconds, not 15 minutes. EmailService also defines sendAccountLockedEmail, and EmailServiceTest verifies its template, but AuthService does not invoke that method in the lock path.

File Responsibility
pom.xml Declares the Java version, Spring Boot parent, runtime dependencies, test dependencies, and Lombok build processing.
src/main/resources/application.properties Defines the default datasource, H2 console, JPA, and SMTP runtime configuration.
src/main/java/com/bankasap/BankAsapApplication.java Starts the application and publishes the PasswordEncoder bean.
src/main/java/com/bankasap/service/AuthService.java Implements sign-up, login, 2FA, lockout, and resend behavior that the quality checks exercise.
src/main/java/com/bankasap/service/EmailService.java Builds and sends the verification and account-lock email templates.
src/test/java/com/bankasap/BankAsapApplicationTests.java Verifies application context startup.
src/test/java/com/bankasap/service/AuthServiceTest.java Verifies authentication service behavior, code generation length, and persistence transitions.
src/test/java/com/bankasap/service/EmailServiceTest.java Verifies mail subject and body construction for 2FA and lock notifications.