feat(auth): add argon2id passwords, sessions, rate limiter, authorization and audit builders

- feat(auth): add argon2id passwords, sessions, rate limiter, authorization and audit builders
- feat(cli): add check and audit commands
- feat(api): add api framework, login, page routes and account, user, delegation and audit handlers
- test(auth): cover passwords, sessions, rate limiter, authorization and audit builders
- test(api): cover the api framework, sessions, client origin, headers and cross-origin refusal
- test(api): cover account, user, delegation and audit handlers and the authorization matrix
- test(ui): cover login, logout, page routes and the page authorization matrix
This commit is contained in:
bryanpedini committed 2026-11-19 15:46:12 +01:00
1 parent 23bec143e3
commit 99fa5de747
28 files changed
+6591 -243

No files matched your search

+3 -1
View File
@@ -47,6 +47,7 @@ type app struct {
openDB func(cfg Config, log *slog.Logger) (*sql.DB, error)
prepareDB func(ctx context.Context, cfg Config, log *slog.Logger) (*sql.DB, tableNames, error)
newUserBackend func(db *sql.DB, t tableNames) cliUserBackend
newReadBackend func(db *sql.DB, t tableNames) cliReadBackend
pingBackoff backoff
healthClient *http.Client
serverStarted func(*WebServer, net.Listener)
@@ -63,11 +64,12 @@ func newApp(lookupEnv func(string) (string, bool), stdin *os.File, stdout, stder
return term.ReadPassword(int(stdin.Fd()))
},
now: time.Now,
hashPassword: stubHashPassword,
hashPassword: hashPassword,
normalizeZone: normalizeZone,
listen: net.Listen,
openDB: openDatabase,
newUserBackend: newSQLUserBackend,
newReadBackend: newSQLReadBackend,
pingBackoff: defaultPingBackoff(),
healthClient: newHealthClient(),
}