[PR #99] [MERGED] feat: Implement comprehensive authentication system #211

Closed
opened 2026-02-26 12:40:37 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE-Local/pull/99
Author: @michelroegl-brunner
Created: 10/10/2025
Status: Merged
Merged: 10/10/2025
Merged by: @michelroegl-brunner

Base: mainHead: feature/auth-system


📝 Commits (10+)

  • 0985461 feat: implement JWT-based authentication system
  • 83beff1 feat: add option to skip enabling auth during setup
  • d3ed2b0 fix: allow proceeding without password when auth is disabled
  • c34f381 feat: don't store credentials when authentication is disabled
  • 8356502 feat: add setup completed flag to prevent modal on every load
  • 93dd03b fix: add missing Authentication tab button in settings modal
  • d5f52ed fix: properly load and display authentication settings
  • 482afd6 fix: handle empty FILTERS environment variable
  • 8d1f11d fix: load authentication credentials when settings modal opens
  • dbcd28c fix: prevent multiple JWT secret generation with caching

📊 Changes

18 files changed (+1498 additions, -6 deletions)

View changed files

📝 .env.example (+5 -0)
📝 next.config.js (+10 -0)
📝 package-lock.json (+150 -1)
📝 package.json (+4 -0)
src/app/_components/AuthGuard.tsx (+73 -0)
src/app/_components/AuthModal.tsx (+111 -0)
src/app/_components/AuthProvider.tsx (+119 -0)
📝 src/app/_components/GeneralSettingsModal.tsx (+237 -1)
src/app/_components/SetupModal.tsx (+204 -0)
📝 src/app/_components/Terminal.tsx (+2 -2)
src/app/api/auth/login/route.ts (+66 -0)
src/app/api/auth/setup/route.ts (+94 -0)
src/app/api/auth/verify/route.ts (+37 -0)
src/app/api/settings/auth-credentials/route.ts (+117 -0)
📝 src/app/api/settings/filters/route.ts (+8 -1)
📝 src/app/layout.tsx (+9 -1)
📝 src/env.js (+12 -0)
src/lib/auth.ts (+240 -0)

📄 Description

🚀 Authentication System Implementation

This PR implements a complete authentication system for the ProxmoxVE Local application with the following features:

Key Features

  • JWT-based authentication with secure token management
  • Bcrypt password hashing for secure credential storage
  • Flexible setup flow - users can enable/disable authentication
  • Auto-login after setup for seamless user experience
  • Settings integration for ongoing credential management
  • Environment-based configuration with .env file storage

🔧 Technical Implementation

  • JWT tokens stored as httpOnly cookies
  • Password hashing using bcrypt (industry standard)
  • Race condition prevention with JWT secret caching
  • Setup completion tracking to prevent repeated setup prompts
  • Comprehensive error handling and user feedback

🎯 User Experience

  • First-time setup modal appears only once
  • Option to skip authentication during initial setup
  • Automatic login after credential setup
  • Settings panel for ongoing authentication management
  • Clean console without unnecessary API calls

🛠️ Files Modified

  • Added authentication API routes (/api/auth/*)
  • Created React components (AuthProvider, AuthGuard, AuthModal, SetupModal)
  • Enhanced settings modal with authentication tab
  • Updated environment configuration
  • Added utility functions for JWT and password management

Testing

  • All build errors resolved
  • ESLint and TypeScript checks pass
  • Authentication flow tested end-to-end
  • Console errors eliminated

🔒 Security Features

  • Secure password hashing with bcrypt
  • JWT tokens with configurable secrets
  • HttpOnly cookies for token storage
  • Environment variable protection
  • Input validation and sanitization

Ready for review and merge! 🎉


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/community-scripts/ProxmoxVE-Local/pull/99 **Author:** [@michelroegl-brunner](https://github.com/michelroegl-brunner) **Created:** 10/10/2025 **Status:** ✅ Merged **Merged:** 10/10/2025 **Merged by:** [@michelroegl-brunner](https://github.com/michelroegl-brunner) **Base:** `main` ← **Head:** `feature/auth-system` --- ### 📝 Commits (10+) - [`0985461`](https://github.com/community-scripts/ProxmoxVE-Local/commit/0985461c39b3191ad2468ed7ba3de682706a3c5c) feat: implement JWT-based authentication system - [`83beff1`](https://github.com/community-scripts/ProxmoxVE-Local/commit/83beff1eb5bf2594cd1fa476158fe1aebf92faa8) feat: add option to skip enabling auth during setup - [`d3ed2b0`](https://github.com/community-scripts/ProxmoxVE-Local/commit/d3ed2b0f4e95328210b6919357848c573405590a) fix: allow proceeding without password when auth is disabled - [`c34f381`](https://github.com/community-scripts/ProxmoxVE-Local/commit/c34f3811259a1e3ca66ae9fdae79e26bc1a6545d) feat: don't store credentials when authentication is disabled - [`8356502`](https://github.com/community-scripts/ProxmoxVE-Local/commit/83565021300620756a5162991dc5b95b85f0a889) feat: add setup completed flag to prevent modal on every load - [`93dd03b`](https://github.com/community-scripts/ProxmoxVE-Local/commit/93dd03b5cd8033cf82a9e8124f615f97c676c757) fix: add missing Authentication tab button in settings modal - [`d5f52ed`](https://github.com/community-scripts/ProxmoxVE-Local/commit/d5f52ed65e97dd8d77a2c6e790b2ed46ea3da2a9) fix: properly load and display authentication settings - [`482afd6`](https://github.com/community-scripts/ProxmoxVE-Local/commit/482afd66ae0c57543c2c40a71c74bafec3a72a98) fix: handle empty FILTERS environment variable - [`8d1f11d`](https://github.com/community-scripts/ProxmoxVE-Local/commit/8d1f11dd1b199df19cc8dc11bce9241307b66205) fix: load authentication credentials when settings modal opens - [`dbcd28c`](https://github.com/community-scripts/ProxmoxVE-Local/commit/dbcd28ce4fe699b85b3859b52ab5f6291b1ec367) fix: prevent multiple JWT secret generation with caching ### 📊 Changes **18 files changed** (+1498 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+5 -0) 📝 `next.config.js` (+10 -0) 📝 `package-lock.json` (+150 -1) 📝 `package.json` (+4 -0) ➕ `src/app/_components/AuthGuard.tsx` (+73 -0) ➕ `src/app/_components/AuthModal.tsx` (+111 -0) ➕ `src/app/_components/AuthProvider.tsx` (+119 -0) 📝 `src/app/_components/GeneralSettingsModal.tsx` (+237 -1) ➕ `src/app/_components/SetupModal.tsx` (+204 -0) 📝 `src/app/_components/Terminal.tsx` (+2 -2) ➕ `src/app/api/auth/login/route.ts` (+66 -0) ➕ `src/app/api/auth/setup/route.ts` (+94 -0) ➕ `src/app/api/auth/verify/route.ts` (+37 -0) ➕ `src/app/api/settings/auth-credentials/route.ts` (+117 -0) 📝 `src/app/api/settings/filters/route.ts` (+8 -1) 📝 `src/app/layout.tsx` (+9 -1) 📝 `src/env.js` (+12 -0) ➕ `src/lib/auth.ts` (+240 -0) </details> ### 📄 Description ## 🚀 Authentication System Implementation This PR implements a complete authentication system for the ProxmoxVE Local application with the following features: ### ✨ Key Features - **JWT-based authentication** with secure token management - **Bcrypt password hashing** for secure credential storage - **Flexible setup flow** - users can enable/disable authentication - **Auto-login after setup** for seamless user experience - **Settings integration** for ongoing credential management - **Environment-based configuration** with .env file storage ### 🔧 Technical Implementation - **JWT tokens** stored as httpOnly cookies - **Password hashing** using bcrypt (industry standard) - **Race condition prevention** with JWT secret caching - **Setup completion tracking** to prevent repeated setup prompts - **Comprehensive error handling** and user feedback ### 🎯 User Experience - **First-time setup modal** appears only once - **Option to skip authentication** during initial setup - **Automatic login** after credential setup - **Settings panel** for ongoing authentication management - **Clean console** without unnecessary API calls ### 🛠️ Files Modified - Added authentication API routes (`/api/auth/*`) - Created React components (`AuthProvider`, `AuthGuard`, `AuthModal`, `SetupModal`) - Enhanced settings modal with authentication tab - Updated environment configuration - Added utility functions for JWT and password management ### ✅ Testing - All build errors resolved - ESLint and TypeScript checks pass - Authentication flow tested end-to-end - Console errors eliminated ### 🔒 Security Features - Secure password hashing with bcrypt - JWT tokens with configurable secrets - HttpOnly cookies for token storage - Environment variable protection - Input validation and sanitization Ready for review and merge! 🎉 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 12:40:37 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ProxmoxVE-Local#211
No description provided.