mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-30 02:52:16 +00:00
feat: Lockout policy (#2121)
* feat: lock users if lockout policy is set * feat: setup * feat: lock user on password failes * feat: render error * feat: lock user on command side * feat: auth_req tests * feat: lockout policy docs * feat: remove show lockout failures from proto * fix: console lockout * feat: tests * fix: tests * unlock function * add unlock button * fix migration version * lockout policy * lint * Update internal/auth/repository/eventsourcing/eventstore/auth_request.go Co-authored-by: Silvan <[email protected]> * fix: err message * Update internal/command/setup_step4.go Co-authored-by: Silvan <[email protected]> Co-authored-by: Max Peintner <[email protected]> Co-authored-by: Livio Amstutz <[email protected]> Co-authored-by: Silvan <[email protected]>
This commit is contained in:
co-authored by
Silvan
Max Peintner
Livio Amstutz
parent
272e411e27
commit
bc951985ed
@@ -51,6 +51,8 @@ import {
|
||||
GetIDPByIDResponse,
|
||||
GetLabelPolicyRequest,
|
||||
GetLabelPolicyResponse,
|
||||
GetLockoutPolicyRequest,
|
||||
GetLockoutPolicyResponse,
|
||||
GetLoginPolicyRequest,
|
||||
GetLoginPolicyResponse,
|
||||
GetOrgFeaturesRequest,
|
||||
@@ -61,8 +63,6 @@ import {
|
||||
GetPasswordAgePolicyResponse,
|
||||
GetPasswordComplexityPolicyRequest,
|
||||
GetPasswordComplexityPolicyResponse,
|
||||
GetPasswordLockoutPolicyRequest,
|
||||
GetPasswordLockoutPolicyResponse,
|
||||
GetPreviewLabelPolicyRequest,
|
||||
GetPreviewLabelPolicyResponse,
|
||||
GetPrivacyPolicyRequest,
|
||||
@@ -144,6 +144,8 @@ import {
|
||||
UpdateIDPResponse,
|
||||
UpdateLabelPolicyRequest,
|
||||
UpdateLabelPolicyResponse,
|
||||
UpdateLockoutPolicyRequest,
|
||||
UpdateLockoutPolicyResponse,
|
||||
UpdateLoginPolicyRequest,
|
||||
UpdateLoginPolicyResponse,
|
||||
UpdateOrgIAMPolicyRequest,
|
||||
@@ -152,8 +154,6 @@ import {
|
||||
UpdatePasswordAgePolicyResponse,
|
||||
UpdatePasswordComplexityPolicyRequest,
|
||||
UpdatePasswordComplexityPolicyResponse,
|
||||
UpdatePasswordLockoutPolicyRequest,
|
||||
UpdatePasswordLockoutPolicyResponse,
|
||||
UpdatePrivacyPolicyRequest,
|
||||
UpdatePrivacyPolicyResponse,
|
||||
} from '../proto/generated/zitadel/admin_pb';
|
||||
@@ -431,20 +431,18 @@ export class AdminService {
|
||||
|
||||
/* lockout */
|
||||
|
||||
public getPasswordLockoutPolicy(): Promise<GetPasswordLockoutPolicyResponse.AsObject> {
|
||||
const req = new GetPasswordLockoutPolicyRequest();
|
||||
return this.grpcService.admin.getPasswordLockoutPolicy(req, null).then(resp => resp.toObject());
|
||||
public getLockoutPolicy(): Promise<GetLockoutPolicyResponse.AsObject> {
|
||||
const req = new GetLockoutPolicyRequest();
|
||||
return this.grpcService.admin.getLockoutPolicy(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public updatePasswordLockoutPolicy(
|
||||
public updateLockoutPolicy(
|
||||
maxAttempts: number,
|
||||
showLockoutFailures: boolean,
|
||||
): Promise<UpdatePasswordLockoutPolicyResponse.AsObject> {
|
||||
const req = new UpdatePasswordLockoutPolicyRequest();
|
||||
req.setMaxAttempts(maxAttempts);
|
||||
req.setShowLockoutFailure(showLockoutFailures);
|
||||
): Promise<UpdateLockoutPolicyResponse.AsObject> {
|
||||
const req = new UpdateLockoutPolicyRequest();
|
||||
req.setMaxPasswordAttempts(maxAttempts);
|
||||
|
||||
return this.grpcService.admin.updatePasswordLockoutPolicy(req, null).then(resp => resp.toObject());
|
||||
return this.grpcService.admin.updateLockoutPolicy(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
/* label */
|
||||
|
||||
@@ -17,14 +17,14 @@ import {
|
||||
AddAppKeyResponse,
|
||||
AddCustomLabelPolicyRequest,
|
||||
AddCustomLabelPolicyResponse,
|
||||
AddCustomLockoutPolicyRequest,
|
||||
AddCustomLockoutPolicyResponse,
|
||||
AddCustomLoginPolicyRequest,
|
||||
AddCustomLoginPolicyResponse,
|
||||
AddCustomPasswordAgePolicyRequest,
|
||||
AddCustomPasswordAgePolicyResponse,
|
||||
AddCustomPasswordComplexityPolicyRequest,
|
||||
AddCustomPasswordComplexityPolicyResponse,
|
||||
AddCustomPasswordLockoutPolicyRequest,
|
||||
AddCustomPasswordLockoutPolicyResponse,
|
||||
AddCustomPrivacyPolicyRequest,
|
||||
AddCustomPrivacyPolicyResponse,
|
||||
AddHumanUserRequest,
|
||||
@@ -122,6 +122,8 @@ import {
|
||||
GetIAMResponse,
|
||||
GetLabelPolicyRequest,
|
||||
GetLabelPolicyResponse,
|
||||
GetLockoutPolicyRequest,
|
||||
GetLockoutPolicyResponse,
|
||||
GetLoginPolicyRequest,
|
||||
GetLoginPolicyResponse,
|
||||
GetMyOrgRequest,
|
||||
@@ -138,8 +140,6 @@ import {
|
||||
GetPasswordAgePolicyResponse,
|
||||
GetPasswordComplexityPolicyRequest,
|
||||
GetPasswordComplexityPolicyResponse,
|
||||
GetPasswordLockoutPolicyRequest,
|
||||
GetPasswordLockoutPolicyResponse,
|
||||
GetPreviewLabelPolicyRequest,
|
||||
GetPreviewLabelPolicyResponse,
|
||||
GetPrivacyPolicyRequest,
|
||||
@@ -298,14 +298,14 @@ import {
|
||||
ResetCustomVerifyPhoneMessageTextToDefaultResponse,
|
||||
ResetLabelPolicyToDefaultRequest,
|
||||
ResetLabelPolicyToDefaultResponse,
|
||||
ResetLockoutPolicyToDefaultRequest,
|
||||
ResetLockoutPolicyToDefaultResponse,
|
||||
ResetLoginPolicyToDefaultRequest,
|
||||
ResetLoginPolicyToDefaultResponse,
|
||||
ResetPasswordAgePolicyToDefaultRequest,
|
||||
ResetPasswordAgePolicyToDefaultResponse,
|
||||
ResetPasswordComplexityPolicyToDefaultRequest,
|
||||
ResetPasswordComplexityPolicyToDefaultResponse,
|
||||
ResetPasswordLockoutPolicyToDefaultRequest,
|
||||
ResetPasswordLockoutPolicyToDefaultResponse,
|
||||
ResetPrivacyPolicyToDefaultRequest,
|
||||
ResetPrivacyPolicyToDefaultResponse,
|
||||
SendHumanResetPasswordNotificationRequest,
|
||||
@@ -324,20 +324,22 @@ import {
|
||||
SetHumanInitialPasswordRequest,
|
||||
SetPrimaryOrgDomainRequest,
|
||||
SetPrimaryOrgDomainResponse,
|
||||
UnlockUserRequest,
|
||||
UnlockUserResponse,
|
||||
UpdateAPIAppConfigRequest,
|
||||
UpdateAPIAppConfigResponse,
|
||||
UpdateAppRequest,
|
||||
UpdateAppResponse,
|
||||
UpdateCustomLabelPolicyRequest,
|
||||
UpdateCustomLabelPolicyResponse,
|
||||
UpdateCustomLockoutPolicyRequest,
|
||||
UpdateCustomLockoutPolicyResponse,
|
||||
UpdateCustomLoginPolicyRequest,
|
||||
UpdateCustomLoginPolicyResponse,
|
||||
UpdateCustomPasswordAgePolicyRequest,
|
||||
UpdateCustomPasswordAgePolicyResponse,
|
||||
UpdateCustomPasswordComplexityPolicyRequest,
|
||||
UpdateCustomPasswordComplexityPolicyResponse,
|
||||
UpdateCustomPasswordLockoutPolicyRequest,
|
||||
UpdateCustomPasswordLockoutPolicyResponse,
|
||||
UpdateCustomPrivacyPolicyRequest,
|
||||
UpdateCustomPrivacyPolicyResponse,
|
||||
UpdateHumanEmailRequest,
|
||||
@@ -556,6 +558,11 @@ export class ManagementService {
|
||||
return this.grpcService.mgmt.listOrgIDPs(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public unlockUser(req: UnlockUserRequest):
|
||||
Promise<UnlockUserResponse.AsObject> {
|
||||
return this.grpcService.mgmt.unlockUser(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public getPrivacyPolicy():
|
||||
Promise<GetPrivacyPolicyResponse.AsObject> {
|
||||
const req = new GetPrivacyPolicyRequest();
|
||||
@@ -1105,36 +1112,31 @@ export class ManagementService {
|
||||
return this.grpcService.mgmt.updateCustomPasswordComplexityPolicy(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public getPasswordLockoutPolicy(): Promise<GetPasswordLockoutPolicyResponse.AsObject> {
|
||||
const req = new GetPasswordLockoutPolicyRequest();
|
||||
|
||||
return this.grpcService.mgmt.getPasswordLockoutPolicy(req, null).then(resp => resp.toObject());
|
||||
public getLockoutPolicy(): Promise<GetLockoutPolicyResponse.AsObject> {
|
||||
const req = new GetLockoutPolicyRequest();
|
||||
return this.grpcService.mgmt.getLockoutPolicy(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public addCustomPasswordLockoutPolicy(
|
||||
public addCustomLockoutPolicy(
|
||||
maxAttempts: number,
|
||||
showLockoutFailures: boolean,
|
||||
): Promise<AddCustomPasswordLockoutPolicyResponse.AsObject> {
|
||||
const req = new AddCustomPasswordLockoutPolicyRequest();
|
||||
req.setMaxAttempts(maxAttempts);
|
||||
req.setShowLockoutFailure(showLockoutFailures);
|
||||
): Promise<AddCustomLockoutPolicyResponse.AsObject> {
|
||||
const req = new AddCustomLockoutPolicyRequest();
|
||||
req.setMaxPasswordAttempts(maxAttempts);
|
||||
|
||||
return this.grpcService.mgmt.addCustomPasswordLockoutPolicy(req, null).then(resp => resp.toObject());
|
||||
return this.grpcService.mgmt.addCustomLockoutPolicy(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public resetPasswordLockoutPolicyToDefault(): Promise<ResetPasswordLockoutPolicyToDefaultResponse.AsObject> {
|
||||
const req = new ResetPasswordLockoutPolicyToDefaultRequest();
|
||||
return this.grpcService.mgmt.resetPasswordLockoutPolicyToDefault(req, null).then(resp => resp.toObject());
|
||||
public resetLockoutPolicyToDefault(): Promise<ResetLockoutPolicyToDefaultResponse.AsObject> {
|
||||
const req = new ResetLockoutPolicyToDefaultRequest();
|
||||
return this.grpcService.mgmt.resetLockoutPolicyToDefault(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public updateCustomPasswordLockoutPolicy(
|
||||
public updateCustomLockoutPolicy(
|
||||
maxAttempts: number,
|
||||
showLockoutFailures: boolean,
|
||||
): Promise<UpdateCustomPasswordLockoutPolicyResponse.AsObject> {
|
||||
const req = new UpdateCustomPasswordLockoutPolicyRequest();
|
||||
req.setMaxAttempts(maxAttempts);
|
||||
req.setShowLockoutFailure(showLockoutFailures);
|
||||
return this.grpcService.mgmt.updateCustomPasswordLockoutPolicy(req, null).then(resp => resp.toObject());
|
||||
): Promise<UpdateCustomLockoutPolicyResponse.AsObject> {
|
||||
const req = new UpdateCustomLockoutPolicyRequest();
|
||||
req.setMaxPasswordAttempts(maxAttempts);
|
||||
return this.grpcService.mgmt.updateCustomLockoutPolicy(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public getLocalizedComplexityPolicyPatternErrorString(policy: PasswordComplexityPolicy.AsObject): string {
|
||||
|
||||
Reference in New Issue
Block a user