Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

🛡️ Secure Password Manager with Role-Based Access Control

An Academic Cybersecurity Prototype combining Java OOP, Spring Boot, MySQL DBMS, and AES-256-GCM Cryptography

Java Spring Boot MySQL License

Project Reference Document: Secure-Password-Manager.pdf
Institution: Department of Computer Science & Engineering (Cyber Security), Amrita Vishwa Vidyapeetham
Academic Year: 2025–2029 (2nd Year B.Tech Project)
Team Members:

  • Yadhunandhan E (CH.SC.U4CYS25041)
  • John Louis F (CH.SC.U4CYS25031)

📌 Executive Summary

The Secure Password Manager is a working academic cybersecurity application designed for clarity, maintainability, and line-by-line explainability during university evaluations. It addresses the vulnerabilities of password reuse and plaintext file storage by integrating:

  • AES-256-GCM Authenticated Encryption: Vault secrets are protected with 256-bit keys and fresh 12-byte random nonces (IVs), ensuring both confidentiality and tamper detection.
  • BCrypt One-Way Hashing: Login passwords are salted and hashed with work factor 10 (1024 derivation rounds).
  • Backend Role-Based Access Control (RBAC): Access policies (ADMIN vs STANDARD_USER) are strictly enforced in Java controllers and service layers, preventing Insecure Direct Object Reference (IDOR) attacks.
  • MySQL 8.0 3NF Normalized DBMS: Features 5 normalized tables, 2 reporting views, 3 automated audit triggers, 2 stored procedures, a stored function, and prepared statements preventing SQL injection.

🚀 Quick Start (Running in 3 Simple Steps)

Step 1: Initialize MySQL Database

Run the consolidated SQL setup script in MySQL Workbench or terminal:

mysql -u root -p < sql/all_in_one_setup.sql

Step 2: Set Environment Variables (PowerShell)

$env:DB_USER="root"
$env:DB_PASSWORD="your_mysql_password"
$env:APP_AES_KEY="0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"

Step 3: Run the Application

.\run.bat

(Or run using Maven directly: mvn spring-boot:run)

Open your browser at: http://localhost:8080


🔑 Pre-Configured Demo Accounts

Role Username Password Purpose & Privileges
ADMIN admin Admin@123 System management, user account status toggles, consolidated audit logs
STANDARD_USER alice Alice@123 Personal encrypted vault, password generation, credential CRUD operations
STANDARD_USER bob Bob@123 Second account verifying cross-account isolation (IDOR protection)

📂 Project Structure

SecurePasswordManager/
├── pom.xml                               # Maven dependencies and build configuration
├── run.bat                               # Windows one-click startup batch script
├── .env.example                          # Environment variable configuration template
├── README.md                             # Primary project documentation
│
├── src/main/java/com/amrita/cys/passwordmanager/
│   ├── SecurePasswordManagerApplication.java  # Spring Boot Application entrypoint
│   ├── config/
│   │   ├── SessionAuthInterceptor.java   # RBAC and session route protector
│   │   └── WebMvcConfig.java             # Spring MVC interceptor registration
│   ├── controller/
│   │   ├── AuthController.java           # Login and logout flows
│   │   ├── HomeController.java           # Root route redirection
│   │   ├── VaultController.java          # Credential CRUD, search, and generator
│   │   ├── AdminController.java          # Admin dashboard, users, and audit logs
│   │   └── GlobalExceptionHandler.java   # Centralized error handler (no stack traces)
│   ├── exception/
│   │   ├── UnauthorizedException.java    # HTTP 403 authorization failures
│   │   ├── ResourceNotFoundException.java# HTTP 404 missing resource failures
│   │   └── CryptoException.java          # Cryptographic / tampering failures
│   ├── model/
│   │   ├── Role.java                     # RBAC enum with attributes
│   │   ├── User.java                     # Abstract base user class (Encapsulation)
│   │   ├── AdminUser.java                # Admin subclass (Inheritance & Overriding)
│   │   ├── StandardUser.java             # Standard user subclass (Inheritance)
│   │   ├── Credential.java               # Vault item entity
│   │   ├── AccessLog.java                # Audit record entity
│   │   ├── UserSummaryDto.java           # DTO mapped to view v_admin_user_summary
│   │   └── AccessLogDetailsDto.java      # DTO mapped to view v_access_log_details
│   ├── repository/
│   │   ├── UserRepository.java           # Parameterized queries for user data
│   │   ├── CredentialRepository.java     # Stored routines & prepared SQL
│   │   └── AccessLogRepository.java      # View queries and security logging
│   ├── security/
│   │   ├── EncryptionStrategy.java       # Cryptographic interface (Abstraction)
│   │   ├── AesGcmEncryptionService.java  # AES-256-GCM cipher (Polymorphism)
│   │   ├── PasswordHasher.java           # BCrypt hasher wrapper
│   │   └── PasswordGenerator.java        # SecureRandom password generator
│   └── service/
│       ├── AuthService.java              # Authentication & session binding
│       ├── CredentialService.java        # Ownership checks & Stream filtering
│       └── AdminService.java             # Admin business logic & view consumption
│
├── src/main/resources/
│   ├── application.properties            # Datasource, session, and AES config
│   ├── static/css/styles.css             # Professional dark-blue security theme
│   └── templates/
│       ├── login.html                    # Sign-in page with demo credentials box
│       ├── vault.html                    # User dashboard, decrypted view, search & filters
│       ├── credential-form.html          # Add / Edit form with generator
│       ├── admin-dashboard.html          # Admin metrics overview
│       ├── user-management.html          # Account governance table
│       ├── audit-logs.html               # Security audit trail table
│       └── error.html                    # Secure user-facing error notice
│
├── sql/
│   ├── all_in_one_setup.sql              # Consolidated one-click database script
│   ├── 01_create_database.sql            # Database creation with UTF-8
│   ├── 02_create_tables.sql              # 3NF tables, foreign keys, indexes
│   ├── 03_create_views.sql               # Admin user summary & audit details views
│   ├── 04_create_procedures.sql          # sp_get_user_credentials & sp_get_audit_logs
│   ├── 05_create_functions.sql           # fn_count_user_credentials scalar function
│   ├── 06_seed_demo_data.sql             # BCrypt hashes & AES-256-GCM ciphertexts
│   ├── 07_create_triggers.sql            # Automated INSERT, UPDATE, DELETE triggers
│   └── 08_advanced_queries.sql          # Joins, GROUP BY, CTE, Window Functions, EXPLAIN
│
└── docs/
    ├── PROJECT_INVENTORY.md              # 📋 Verified component inventory & exact counts
    ├── FILE_AND_LINE_GUIDE.md            # ⭐ Verified line-by-line faculty viva guide
    ├── OOP_CONCEPT_MAP.md                # Explanations of OOP concepts with code mappings
    ├── DBMS_CONCEPT_MAP.md               # 3NF schema, ACID, views, routines, and triggers
    ├── VIVA_QUESTIONS_AND_ANSWERS.md     # 45 practical viva exam questions with answers
    ├── RUN_INSTRUCTIONS.md               # Step-by-step setup and verification steps
    └── PROJECT_OVERVIEW.md               # Architecture and cybersecurity rationale

📚 Evaluation & Viva Documentation

The docs/ folder contains dedicated guides for answering faculty questions:

  1. FILE_AND_LINE_GUIDE.md: The most critical deliverable. Lists the exact file path and line numbers for every single feature, SQL routine, security check, and OOP concept.
  2. OOP_CONCEPT_MAP.md: Clear English explanations of Encapsulation, Inheritance, Abstraction, Polymorphism, Method Overriding, Method Overloading, Collections, Streams, and Custom Exceptions.
  3. DBMS_CONCEPT_MAP.md: Schema 3NF normalization justification, views, automated triggers, stored procedures, stored functions, and ACID transaction mechanics.
  4. VIVA_QUESTIONS_AND_ANSWERS.md: 45 practical questions and answers with line-number references.
  5. RUN_INSTRUCTIONS.md: Detailed installation and live viva presentation steps.

🧪 Automated Testing

The project includes automated JUnit 5 tests covering cryptographic operations, BCrypt verification, OOP polymorphism, and IDOR ownership authorization:

mvn test

Result: 13 tests executed, 0 failures, 0 errors.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages