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
@@ -41,3 +41,20 @@ message PasswordComplexitySettings {
}
];
}
message PasswordExpirySettings {
// Amount of days after which a password will expire. The user will be forced to change the password on the following authentication.
uint64 max_age_days = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"365\""
}
];
// Amount of days after which the user should be notified of the upcoming expiry. ZITADEL will not notify the user.
uint64 expire_warn_days = 2 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"10\""
}
];
// resource_owner_type returns if the settings is managed on the organization or on the instance
ResourceOwnerType resource_owner_type = 3;
}
@@ -204,6 +204,30 @@ service SettingsService {
};
}
// Get the password expiry settings
rpc GetPasswordExpirySettings (GetPasswordExpirySettingsRequest) returns (GetPasswordExpirySettingsResponse) {
option (google.api.http) = {
get: "/v2beta/settings/password/expiry"
};
option (zitadel.protoc_gen_zitadel.v2.options) = {
auth_option: {
permission: "policy.read"
}
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Get the password expiry settings";
description: "Return the password expiry settings for the requested context"
responses: {
key: "200"
value: {
description: "OK";
}
};
};
}
// Get the current active branding settings
rpc GetBrandingSettings (GetBrandingSettingsRequest) returns (GetBrandingSettingsResponse) {
option (google.api.http) = {
@@ -358,6 +382,15 @@ message GetPasswordComplexitySettingsResponse {
zitadel.settings.v2beta.PasswordComplexitySettings settings = 2;
}
message GetPasswordExpirySettingsRequest {
zitadel.object.v2beta.RequestContext ctx = 1;
}
message GetPasswordExpirySettingsResponse {
zitadel.object.v2beta.Details details = 1;
zitadel.settings.v2beta.PasswordExpirySettings settings = 2;
}
message GetBrandingSettingsRequest {
zitadel.object.v2beta.RequestContext ctx = 1;
}