A secure Java-based authentication service with built-in encryption and decryption capabilities, designed for applications requiring secure data handling, user authentication, and cryptographic operations.
This project provides a modular, scalable, and secure authentication service with the following core features:
- User Authentication: Secure login/logout and token-based authentication.
- Data Encryption/Decryption: Protect sensitive data using industry-standard cryptographic algorithms.
- RESTful API: Easy-to-integrate endpoints for authentication and encryption operations.
- Modular Architecture: Separation of concerns with dedicated layers for controllers, services, repositories, and utilities.
- User Login/Logout: Secure authentication using credentials.
- Token Generation: JWT (JSON Web Token) or custom token generation for session management.
- Role-Based Access Control (RBAC): Assign and validate user roles for authorization.
- Symmetric Encryption: Uses AES (Advanced Encryption Standard) for encrypting/decrypting sensitive data.
- Key Management: Secure storage and retrieval of encryption keys.
- Customizable Algorithms: Easily extendable to support other encryption standards (e.g., RSA, Blowfish).
- Authentication:
POST /api/auth/login: Authenticate users and return a token.POST /api/auth/logout: Invalidate user sessions.
- Encryption/Decryption:
POST /api/encrypt: Encrypt a plaintext message.POST /api/decrypt: Decrypt a ciphertext message.
- JPA/Hibernate: ORM for database operations.
- User Entity: Stores user credentials, roles, and metadata.
- Encryption Keys: Securely stored and managed.
- Password Hashing: Uses BCrypt or PBKDF2 for secure password storage.
- Input Validation: Protects against common vulnerabilities (e.g., SQL injection, XSS).
- HTTPS Support: Encrypted communication for all API endpoints.
| Directory | Description |
|---|---|
controller/ |
REST API endpoints for handling authentication and encryption/decryption requests. |
dto/ |
Data Transfer Objects (DTOs) for request/response payloads. |
encryption/ |
Core encryption/decryption logic, including key management and algorithm implementations. |
entity/ |
JPA entities for database mapping (e.g., User, EncryptionKey). |
repository/ |
Database access layer (Spring Data JPA repositories). |
service/ |
Business logic for authentication, encryption, and user management. |
common/ |
Shared utilities, constants, and helper classes. |
resources/ |
Configuration files (e.g., application.properties, application.yml) and static resources. |
- Java 8+
- Maven 3.6+
- Spring Boot 2.7+
- Database: MySQL or H2 (for testing).
- Clone the Repository:
git clone https://github.com/SujalGadhave/auth-service-encrypt-decrypt.git cd auth-service-encrypt-decrypt