feat: login history and lockout rule in services-system
LoginSecurityService derives the admin lock from login_audit and the ADMIN_LOGIN_BLOCK settings; /loginSecurity exposes lock check, record, history, locked list, unlock, lockout settings and password rules. The gateway routes /loginSecurity/** and lets the lock check and record through without a user token for the sign-in path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
a0146be325
commit
f7ec74c7f0
11 files changed
+1074
-2
No files matched your search
@@ -68,7 +68,7 @@ Full design with approaches and the user's approved calls: `docs/superpowers/spe
|
||||
- Then the existing check:
|
||||
- an unknown, wrong, disabled or upstream-failed check records `LOGIN_FAIL`;
|
||||
- a success records `LOGIN_SUCCESS`.
|
||||
- Recording goes through `LoginAuditClient.record(...)`, which catches and logs every exception.
|
||||
- The lock check and recording are methods on `AdminAuthenticationService` (`isLocked`, which fails open, and `record`, which catches and logs every exception). No new class, so the existing controller tests and their mocks stay unchanged.
|
||||
- Logout records `LOGOUT` for the token's user.
|
||||
|
||||
6. **Client IP and user agent:**
|
||||
|
||||
@@ -17,7 +17,7 @@ Design: `design.md`. All tasks run serially: each builds on the one before.
|
||||
|
||||
## 2. services-system
|
||||
|
||||
- [ ] 2.1 `LoginAudit` entity and repository, `LoginSecurityService` and `LoginSecurityController` (design decisions 2 and 3), plus the gateway route `/loginSecurity/**` to services-system.
|
||||
- [x] 2.1 `LoginAudit` entity and repository, `LoginSecurityService` and `LoginSecurityController` (design decisions 2 and 3), plus the gateway route `/loginSecurity/**` to services-system.
|
||||
- Before coding: check how mobile-api reaches services-system before a user has a token (the forgot-password path). Match that for `isLocked` and `record`, and note the finding in the task report.
|
||||
- **Tests first:**
|
||||
- locked at `max` failures inside the period;
|
||||
|
||||
Reference in new issue
Block a user