engripaye /
complete-iam-system
๐ฅ๐ Identity Access Management (IAM) system using Java 21, Spring Boot 3.5, and the OAuth 2.0 protocol for authentication and authorization.
Loading repository dataโฆ
jimitchavdadev / repository
๐ Complete Java TOTP 2FA System with PostgreSQL integration. Generates QR codes for Google Authenticator setup, implements RFC 6238 standard, features secure password hashing & terminal-based registration flow. Production-ready two-factor authentication solution.
A complete Java-based Two-Factor Authentication (2FA) system that integrates with Google Authenticator and PostgreSQL database for secure user registration and authentication.
This TOTP (Time-based One-Time Password) Authentication System provides a robust 2FA implementation for Java applications. It generates QR codes for easy setup with Google Authenticator, securely stores user credentials in PostgreSQL, and validates time-based authentication codes.
The system is designed for applications requiring enhanced security through two-factor authentication, making it suitable for enterprise applications, secure portals, and any system where user authentication security is paramount.
Before running this application, ensure you have:
git clone <repository-url>
cd TOTP-Auth
Add the following dependencies to your pom.xml:
<dependencies>
<!-- ZXing for QR Code generation -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.5.1</version>
</dependency>
<!-- PostgreSQL JDBC Driver -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.6.0</version>
</dependency>
</dependencies>
mvn clean install
CREATE DATABASE totp_auth;
Update the database configuration in src/main/java/com/totp/config/DatabaseConfig.java:
private static final String DB_URL = "jdbc:postgresql://localhost:5432/totp_auth";
private static final String DB_USER = "your_username";
private static final String DB_PASSWORD = "your_password";
The application automatically creates the required table on first run:
CREATE TABLE users (
id SERIAL PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
username VARCHAR(100) NOT NULL,
password VARCHAR(255) NOT NULL,
totp_secret VARCHAR(255),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
src/main/java/com/totp/
โโโ app/
โ โโโ TOTPRegistrationApp.java # Main application entry point
โโโ config/
โ โโโ DatabaseConfig.java # Database configuration and setup
โโโ model/
โ โโโ User.java # User entity model
โโโ service/
โ โโโ TOTPService.java # TOTP generation and verification
โ โโโ QRCodeService.java # QR code display functionality
โ โโโ UserService.java # Database operations for users
โโโ util/
โโโ ConsoleColors.java # Terminal color constants
โโโ InputValidator.java # Input validation utilities
โโโ PasswordUtil.java # Password hashing and verification
User Input Collection
TOTP Secret Generation
QR Code Generation
otpauth:// URL with user email and secret2FA Verification
Database Storage
# Compile the project
mvn compile
# Run the main application
mvn exec:java -Dexec.mainClass="com.totp.TOTPRegistrationApp"
# Or run directly with Java
java -cp target/classes com.totp.TOTPRegistrationApp
Start the application
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ 2FA Registration System โ
โ Google Authenticator Required โ
โ PostgreSQL Database โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Enter user details
Scan QR Code
Verify Setup
Test Login (Optional)
Modify DatabaseConfig.java for your PostgreSQL setup:
private static final String DB_URL = "jdbc:postgresql://hostname:port/database_name";
private static final String DB_USER = "your_username";
private static final String DB_PASSWORD = "your_password";
Current configuration in TOTPService.java:
APP_NAME in TOTPService.javagenerateSecret()InputValidator.javaConsoleColors.javaSecureRandomgit checkout -b feature/new-feature)git commit -am 'Add new feature')git push origin feature/new-feature)This project is licensed under the MIT License - see the LICENSE file for details.
For questions, issues, or contributions:
Note: This system provides production-ready 2FA implementation. Ensure proper testing in your environment before deployment in production systems.
Selected from shared topics, language and repository descriptionโnot editorial ratings.
engripaye /
๐ฅ๐ Identity Access Management (IAM) system using Java 21, Spring Boot 3.5, and the OAuth 2.0 protocol for authentication and authorization.
Sandhiyamrs /
โจ A clean and practical Java project demonstrating complete Object-Oriented Programming (OOP) concepts โ including ๐งฉ classes, ๐๏ธ inheritance, ๐ polymorphism, ๐ encapsulation, ๐ง abstraction, โ๏ธ composition, and ๐ฏ simple design patterns.
goraipankaj /
๐ Mini Project Completed โ E-Commerce Cart System ๐ป Iโm excited to share my mini project built using Java as part of my internship at TechnoHacks EduTech! This project simulates a simple e-commerce cart system with features like: ๐๏ธ Product listing ๐ Add/Remove from Cart ๐พ Save cart to file ๐ Login/Register system ๐ธ