auth: Registrierung, Login, Logout, per-user Sessions (Backend)

This commit is contained in:
OpenClaw Dev 2026-10-31 11:28:17 +01:00
parent c7b4acea02
commit 0ef39cffd6
12 changed files with 703 additions and 40 deletions

View file

@ -36,9 +36,21 @@ func TestLoadJSON(t *testing.T) {
}
}
func TestValidateRequiresToken(t *testing.T) {
t.Setenv("BYTECLAW_AUTH_TOKEN", "")
func TestValidateShortToken(t *testing.T) {
t.Setenv("BYTECLAW_AUTH_TOKEN", "short")
if _, err := Load(""); err == nil {
t.Fatal("expected error without token")
t.Fatal("expected error for short token")
}
t.Setenv("BYTECLAW_AUTH_TOKEN", "")
c, err := Load("")
if err != nil {
t.Fatalf("token is optional now: %v", err)
}
if !c.RegistrationAllowed() {
t.Fatal("registration must default to true")
}
t.Setenv("BYTECLAW_ALLOW_REGISTRATION", "false")
if c, _ = Load(""); c.RegistrationAllowed() {
t.Fatal("env must disable registration")
}
}