feat(users/v2): return prompt information (#9255)

# Which Problems Are Solved

Add the ability to update the timestamp when MFA initialization was last
skipped.
Get User By ID now also returns the timestamps when MFA setup was last
skipped.

# How the Problems Are Solved

- Add a `HumanMFAInitSkipped` method to the `users/v2` API.
- MFA skipped was already projected in the `auth.users3` table. In this
PR the same column is added to the users projection. Event handling is
kept the same as in the `UserView`:

<details>


62804ca45f/internal/user/repository/view/model/user.go (L243-L377)

</details>

# Additional Changes

- none

# Additional Context

- Closes https://github.com/zitadel/zitadel/issues/9197
This commit is contained in:
Tim Möhlmann
2025-01-29 17:12:31 +02:00
committed by GitHub
parent df8bac8a28
commit b6841251b1
28 changed files with 673 additions and 364 deletions

View File

@@ -175,6 +175,8 @@ message HumanUser {
bool password_change_required = 9;
// The time the user last changed their password.
google.protobuf.Timestamp password_changed = 10;
// The time the user last skipped MFA initialization.
google.protobuf.Timestamp mfa_init_skipped = 11;
}
message User {

View File

@@ -1206,6 +1206,32 @@ service UserService {
};
};
}
// MFA Init Skipped
//
// Update the last time the user has skipped MFA initialization. The server timestamp is used.
rpc HumanMFAInitSkipped(HumanMFAInitSkippedRequest) returns (HumanMFAInitSkippedResponse) {
option (google.api.http) = {
post: "/v2/users/{user_id}/mfa_init_skipped"
body: "*"
};
option (zitadel.protoc_gen_zitadel.v2.options) = {
auth_option: {
permission: "authenticated"
}
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
responses: {
key: "200"
value: {
description: "OK";
}
};
};
}
}
message AddHumanUserRequest{
@@ -2336,3 +2362,19 @@ message VerifyInviteCodeRequest {
message VerifyInviteCodeResponse {
zitadel.object.v2.Details details = 1;
}
message HumanMFAInitSkippedRequest {
string user_id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
(google.api.field_behavior) = REQUIRED,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
min_length: 1;
max_length: 200;
example: "\"69629012906488334\"";
}
];
}
message HumanMFAInitSkippedResponse {
zitadel.object.v2.Details details = 1;
}