feat(auth): implement session-based authentication and API token management
- Introduced a new authentication system using session cookies for the web dashboard and API tokens for sync clients. - Replaced the old SERVER_PASSWORD scheme with a more secure API token mechanism. - Added routes for user setup, login, logout, and credential updates. - Implemented middleware to require session and API token for protected routes. - Updated web UI to handle authentication states and provide user feedback. - Enhanced error handling in API requests and responses. - Updated README to reflect new authentication flow and database requirements.
This commit is contained in:
1 parent
240e1fda4a
commit
b150d835a1
18 files changed
+1022
-982
No files matched your search
@@ -3,25 +3,12 @@
|
||||
#################################################################
|
||||
PORT=3000
|
||||
NODE_ENV=production
|
||||
SERVER_PASSWORD=your_secure_password_here
|
||||
|
||||
# Set to "true" once served over HTTPS - marks the admin session cookie Secure.
|
||||
COOKIE_SECURE=false
|
||||
|
||||
#################################################################
|
||||
# Database backend selection
|
||||
# - sqlite (default if not set)
|
||||
# - postgres
|
||||
#################################################################
|
||||
# Choose the DB client; if omitted or not set to "postgres", SQLite is used
|
||||
DB_CLIENT=sqlite
|
||||
|
||||
#################################################################
|
||||
# SQLite configuration (used when DB_CLIENT=sqlite)
|
||||
#################################################################
|
||||
# Path to the SQLite database file. Default in code: ./data/collabtable.db
|
||||
# For Docker, you may prefer a volume path like /data/collabtable.db
|
||||
DB_PATH=/data/collabtable.db
|
||||
|
||||
#################################################################
|
||||
# PostgreSQL configuration (used when DB_CLIENT=postgres)
|
||||
# PostgreSQL configuration
|
||||
# You can either provide a single DATABASE_URL or the PG* variables below
|
||||
#################################################################
|
||||
# Example URL: postgres://user:password@localhost:5432/collabtable
|
||||
@@ -35,7 +22,7 @@ PGPASSWORD=
|
||||
PGDATABASE=collabtable
|
||||
|
||||
#################################################################
|
||||
# Startup resilience and sync/auth tuning
|
||||
# Startup resilience and sync tuning
|
||||
#################################################################
|
||||
# DB init retry interval in milliseconds (default: 5000)
|
||||
DB_INIT_RETRY_INTERVAL_MS=5000
|
||||
@@ -43,9 +30,6 @@ DB_INIT_RETRY_INTERVAL_MS=5000
|
||||
# Max DB init retry attempts. 0 means retry forever (default: 0)
|
||||
DB_INIT_RETRY_MAX_ATTEMPTS=0
|
||||
|
||||
# Suppress repetitive auth warning logs for the same path/method (default: 30000)
|
||||
AUTH_LOG_THROTTLE_MS=30000
|
||||
|
||||
# Allow at most this much client clock skew into sync timestamps (default: 0)
|
||||
# Keep this at 0 to prevent future-dated rows from being re-sent in hot loops.
|
||||
SYNC_MAX_FUTURE_SKEW_MS=0
|
||||
Reference in new issue
Block a user