mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 00:57:33 +00:00
feat: provide option to limit (T)OTP checks (#7693)
* feat: provide option to limit (T)OTP checks * fix requests in console * update errors pkg * cleanup * cleanup * improve naming of existing config
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
LockoutPolicyTable = "projections.lockout_policies2"
|
||||
LockoutPolicyTable = "projections.lockout_policies3"
|
||||
|
||||
LockoutPolicyIDCol = "id"
|
||||
LockoutPolicyCreationDateCol = "creation_date"
|
||||
@@ -25,8 +25,8 @@ const (
|
||||
LockoutPolicyResourceOwnerCol = "resource_owner"
|
||||
LockoutPolicyInstanceIDCol = "instance_id"
|
||||
LockoutPolicyMaxPasswordAttemptsCol = "max_password_attempts"
|
||||
LockoutPolicyMaxOTPAttemptsCol = "max_otp_attempts"
|
||||
LockoutPolicyShowLockOutFailuresCol = "show_failure"
|
||||
LockoutPolicyOwnerRemovedCol = "owner_removed"
|
||||
)
|
||||
|
||||
type lockoutPolicyProjection struct{}
|
||||
@@ -51,11 +51,10 @@ func (*lockoutPolicyProjection) Init() *old_handler.Check {
|
||||
handler.NewColumn(LockoutPolicyResourceOwnerCol, handler.ColumnTypeText),
|
||||
handler.NewColumn(LockoutPolicyInstanceIDCol, handler.ColumnTypeText),
|
||||
handler.NewColumn(LockoutPolicyMaxPasswordAttemptsCol, handler.ColumnTypeInt64),
|
||||
handler.NewColumn(LockoutPolicyMaxOTPAttemptsCol, handler.ColumnTypeInt64, handler.Default(0)),
|
||||
handler.NewColumn(LockoutPolicyShowLockOutFailuresCol, handler.ColumnTypeBool),
|
||||
handler.NewColumn(LockoutPolicyOwnerRemovedCol, handler.ColumnTypeBool, handler.Default(false)),
|
||||
},
|
||||
handler.NewPrimaryKey(LockoutPolicyInstanceIDCol, LockoutPolicyIDCol),
|
||||
handler.WithIndex(handler.NewIndex("owner_removed", []string{LockoutPolicyOwnerRemovedCol})),
|
||||
),
|
||||
)
|
||||
}
|
||||
@@ -125,6 +124,7 @@ func (p *lockoutPolicyProjection) reduceAdded(event eventstore.Event) (*handler.
|
||||
handler.NewCol(LockoutPolicyIDCol, policyEvent.Aggregate().ID),
|
||||
handler.NewCol(LockoutPolicyStateCol, domain.PolicyStateActive),
|
||||
handler.NewCol(LockoutPolicyMaxPasswordAttemptsCol, policyEvent.MaxPasswordAttempts),
|
||||
handler.NewCol(LockoutPolicyMaxOTPAttemptsCol, policyEvent.MaxOTPAttempts),
|
||||
handler.NewCol(LockoutPolicyShowLockOutFailuresCol, policyEvent.ShowLockOutFailures),
|
||||
handler.NewCol(LockoutPolicyIsDefaultCol, isDefault),
|
||||
handler.NewCol(LockoutPolicyResourceOwnerCol, policyEvent.Aggregate().ResourceOwner),
|
||||
@@ -149,6 +149,9 @@ func (p *lockoutPolicyProjection) reduceChanged(event eventstore.Event) (*handle
|
||||
if policyEvent.MaxPasswordAttempts != nil {
|
||||
cols = append(cols, handler.NewCol(LockoutPolicyMaxPasswordAttemptsCol, *policyEvent.MaxPasswordAttempts))
|
||||
}
|
||||
if policyEvent.MaxOTPAttempts != nil {
|
||||
cols = append(cols, handler.NewCol(LockoutPolicyMaxOTPAttemptsCol, *policyEvent.MaxOTPAttempts))
|
||||
}
|
||||
if policyEvent.ShowLockOutFailures != nil {
|
||||
cols = append(cols, handler.NewCol(LockoutPolicyShowLockOutFailuresCol, *policyEvent.ShowLockOutFailures))
|
||||
}
|
||||
|
Reference in New Issue
Block a user