Initial Email-Forwarder scaffold
This commit is contained in:
commit
91e52aecd0
22 changed files with 1007 additions and 0 deletions
28
backend/03-auth.go
Normal file
28
backend/03-auth.go
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package backend
|
||||
|
||||
import "net/http"
|
||||
|
||||
// InitAuth bereitet die Session-/Login-Verwaltung vor.
|
||||
//
|
||||
// Sicherheitslage: Dieses Tool haelt IMAP-Zugangsdaten fremder Postfaecher und
|
||||
// kann per SMTP Mails verschicken. Es darf NIE offen im Netz stehen.
|
||||
// - Default: bind 127.0.0.1 (nur lokal), Login mit admin_user/admin_pass.
|
||||
// - Wenn spaeter remote erreichbar (hinter Caddy): /vadmin-Mail-2FA-Muster
|
||||
// aus dem Web-Deploy-Kit vorschalten.
|
||||
func InitAuth() error {
|
||||
// TODO Codex: Session-Cookie-Store initialisieren.
|
||||
return nil
|
||||
}
|
||||
|
||||
// AuthMiddleware schuetzt alle Routen ausser /login und /static.
|
||||
func AuthMiddleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// TODO Codex: /login + /static durchlassen, sonst Session pruefen,
|
||||
// sonst Redirect /login.
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
func loginHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// TODO Codex: Formular, Abgleich mit Cfg.AdminUser/AdminPass, Cookie setzen.
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue