feat: password age policy (#8132)

# Which Problems Are Solved

Some organizations / customers have the requirement, that there users
regularly need to change their password.
ZITADEL already had the possibility to manage a `password age policy` (
thought the API) with the maximum amount of days a password should be
valid, resp. days after with the user should be warned of the upcoming
expiration.
The policy could not be managed though the Console UI and was not
checked in the Login UI.

# How the Problems Are Solved

- The policy can be managed in the Console UI's settings sections on an
instance and organization level.
- During an authentication in the Login UI, if a policy is set with an
expiry (>0) and the user's last password change exceeds the amount of
days set, the user will be prompted to change their password.
- The prompt message of the Login UI can be customized in the Custom
Login Texts though the Console and API on the instance and each
organization.
- The information when the user last changed their password is returned
in the Auth, Management and User V2 API.
- The policy can be retrieved in the settings service as `password
expiry settings`.

# Additional Changes

None.

# Additional Context

- closes #8081

---------

Co-authored-by: Tim Möhlmann <[email protected]>
This commit is contained in:
Livio Spring
2024-06-18 11:27:44 +00:00
committed by GitHub
co-authored by Tim Möhlmann
parent 65f787cc02
commit fb8cd18f93
93 changed files with 1250 additions and 487 deletions
+9 -10
View File
@@ -4742,7 +4742,6 @@ service ManagementService {
};
}
// The password age policy is not used at the moment
rpc GetPasswordAgePolicy(GetPasswordAgePolicyRequest) returns (GetPasswordAgePolicyResponse) {
option (google.api.http) = {
get: "/policies/password/age"
@@ -4756,7 +4755,7 @@ service ManagementService {
tags: "Settings";
tags: "Password Settings";
summary: "Get Password Age Settings";
description: "Not implemented";
description: "Returns the password age settings configured on the organization. The settings specify the expiry of password, after which a user is forced to change it on the next login.";
parameters: {
headers: {
name: "x-zitadel-orgid";
@@ -4768,7 +4767,6 @@ service ManagementService {
};
}
// The password age policy is not used at the moment
rpc GetDefaultPasswordAgePolicy(GetDefaultPasswordAgePolicyRequest) returns (GetDefaultPasswordAgePolicyResponse) {
option (google.api.http) = {
get: "/policies/default/password/age"
@@ -4782,7 +4780,7 @@ service ManagementService {
tags: "Settings";
tags: "Password Settings";
summary: "Get Default Password Age Settings";
description: "Not implemented";
description: "Returns the default password age settings configured on the instance. The settings specify the expiry of password, after which a user is forced to change it on the next login.";
parameters: {
headers: {
name: "x-zitadel-orgid";
@@ -4794,7 +4792,6 @@ service ManagementService {
};
}
// The password age policy is not used at the moment
rpc AddCustomPasswordAgePolicy(AddCustomPasswordAgePolicyRequest) returns (AddCustomPasswordAgePolicyResponse) {
option (google.api.http) = {
post: "/policies/password/age"
@@ -4809,7 +4806,7 @@ service ManagementService {
tags: "Settings";
tags: "Password Settings";
summary: "Add Password Age Settings";
description: "Not implemented";
description: "Create new password age settings for the organization. This will overwrite the settings of the instance for this organization. The settings specify the expiry of password, after which a user is forced to change it on the next login.";
parameters: {
headers: {
name: "x-zitadel-orgid";
@@ -4821,7 +4818,6 @@ service ManagementService {
};
}
// The password age policy is not used at the moment
rpc UpdateCustomPasswordAgePolicy(UpdateCustomPasswordAgePolicyRequest) returns (UpdateCustomPasswordAgePolicyResponse) {
option (google.api.http) = {
put: "/policies/password/age"
@@ -4836,7 +4832,7 @@ service ManagementService {
tags: "Settings";
tags: "Password Settings";
summary: "Update Password Age Settings";
description: "Not implemented";
description: "Update the password age settings of the organization. The settings specify the expiry of password, after which a user is forced to change it on the next login.";
parameters: {
headers: {
name: "x-zitadel-orgid";
@@ -4848,7 +4844,6 @@ service ManagementService {
};
}
// The password age policy is not used at the moment
rpc ResetPasswordAgePolicyToDefault(ResetPasswordAgePolicyToDefaultRequest) returns (ResetPasswordAgePolicyToDefaultResponse) {
option (google.api.http) = {
delete: "/policies/password/age"
@@ -4862,7 +4857,7 @@ service ManagementService {
tags: "Settings";
tags: "Password Settings";
summary: "Reset Password Age Settings to Default";
description: "Not implemented";
description: "Remove the password age settings of the organization and therefore use the default settings on the instance.. The settings specify the expiry of password, after which a user is forced to change it on the next login.";
parameters: {
headers: {
name: "x-zitadel-orgid";
@@ -10604,7 +10599,9 @@ message GetDefaultPasswordAgePolicyResponse {
}
message AddCustomPasswordAgePolicyRequest {
// Amount of days after which a password will expire. The user will be forced to change the password on the following authentication.
uint32 max_age_days = 1;
// Amount of days after which the user should be notified of the upcoming expiry. ZITADEL will not notify the user.
uint32 expire_warn_days = 2;
}
@@ -10613,7 +10610,9 @@ message AddCustomPasswordAgePolicyResponse {
}
message UpdateCustomPasswordAgePolicyRequest {
// Amount of days after which a password will expire. The user will be forced to change the password on the following authentication.
uint32 max_age_days = 1;
// Amount of days after which the user should be notified of the upcoming expiry. ZITADEL will not notify the user.
uint32 expire_warn_days = 2;
}