Add password authentication to WebUI and implement session management

- Updated WebUI configuration to include a password field for authentication.
- Enhanced the WebUI server to handle login and logout functionality with session management.
- Added tests for authentication and session handling.
- Updated README and example configuration to reflect new authentication features.
This commit is contained in:
Andy Oknen 2025-07-30 08:34:29 +00:00
parent 51e1ef3ed0
commit 113dcbb72a
17 changed files with 676 additions and 74 deletions

View file

@ -308,7 +308,12 @@ func main() {
listenAddr = fmt.Sprintf("%s:%d", cfg.WebUI.Host, cfg.WebUI.Port)
}
n.webui = webui.Server(listenAddr, logger)
n.webui = webui.Server(listenAddr, cfg.WebUI.Password, logger)
if cfg.WebUI.Password != "" {
logger.Infof("WebUI password authentication enabled")
} else {
logger.Warnf("WebUI running without password protection")
}
go func() {
if err := n.webui.Start(); err != nil {
logger.Errorf("WebUI server error: %v", err)