feat(auth): Implement multi-user login support

- Add an `accounts` dictionary in `AuthHandler` to store multiple user account information.
- Modify login logic to support multiple user account verification.
- Update environment variable example, add description for `AUTH_ACCOUNTS` variable.
- Adjust authentication status check logic, use `auth_handler.accounts` to determine if authentication is configured.
This commit is contained in:
Milin
2025-03-24 14:34:31 +08:00
parent e2737e4412
commit 4dfdb9032c
4 changed files with 18 additions and 21 deletions

View File

@@ -151,9 +151,8 @@ QDRANT_URL=http://localhost:16333
### Redis
REDIS_URI=redis://localhost:6379
### For JWTt Auth
AUTH_USERNAME=admin # login name
AUTH_PASSWORD=admin123 # password
TOKEN_SECRET=your-key-for-LightRAG-API-Server # JWT key
TOKEN_EXPIRE_HOURS=4 # expire duration
WHITELIST_PATHS=/login,/health # white list
### For JWT Auth
# AUTH_ACCOUNTS='admin:admin123,user1:pass456' # username:password,username:password
# TOKEN_SECRET=Your-Key-For-LightRAG-API-Server # JWT key
# TOKEN_EXPIRE_HOURS=4 # expire duration
# WHITELIST_PATHS= # white list