feat: 实现登录失败锁定功能
新增了登录失败次数统计和临时锁定机制,包括: 1. 定义登录锁定数据结构和数据库表结构 2. 实现租户级别的锁定状态持久化接口 3. 添加登录速率限制安全策略配置 4. 在登录流程中加入锁定前置检查和失败计数逻辑 5. 提供管理员手动解锁的内部API接口 6. 新增中文本地化的锁定提示文案
This commit is contained in:
@@ -285,6 +285,16 @@ type TenantRegistrationInviteAdapter interface {
|
||||
TenantRegistrationInviteSyncUsage(t.TenantID, int64) error
|
||||
}
|
||||
|
||||
// TenantLoginLockoutAdapter persists per-account login failure counters and
|
||||
// lock state in each tenant business database.
|
||||
type TenantLoginLockoutAdapter interface {
|
||||
TenantLoginLockoutGet(t.TenantID, string) (*t.LoginLockout, error)
|
||||
TenantLoginLockoutRecordFailure(t.TenantID, string, *int64, time.Time, time.Time) (*t.LoginLockout, error)
|
||||
TenantLoginLockoutLock(t.TenantID, string, time.Time, time.Time) error
|
||||
TenantLoginLockoutReset(t.TenantID, string) error
|
||||
TenantLoginLockoutRelease(t.TenantID, string, time.Time) error
|
||||
}
|
||||
|
||||
// TenantAuthAdapter is the tenant-aware authentication and credential capability.
|
||||
// It is separate from Adapter while the remaining persistence domains are migrated.
|
||||
type TenantAuthAdapter interface {
|
||||
|
||||
Reference in New Issue
Block a user