Files
zitadel/proto/zitadel/user/v2/pat.proto
T
8fc11a7366 feat: user api requests to resource API (#9794)
# Which Problems Are Solved

This pull request addresses a significant gap in the user service v2
API, which currently lacks methods for managing machine users.

# How the Problems Are Solved

This PR adds new API endpoints to the user service v2 to manage machine
users including their secret, keys and personal access tokens.
Additionally, there's now a CreateUser and UpdateUser endpoints which
allow to create either a human or machine user and update them. The
existing `CreateHumanUser` endpoint has been deprecated along the
corresponding management service endpoints. For details check the
additional context section.

# Additional Context

- Closes https://github.com/zitadel/zitadel/issues/9349

## More details
- API changes: https://github.com/zitadel/zitadel/pull/9680
- Implementation: https://github.com/zitadel/zitadel/pull/9763
- Tests: https://github.com/zitadel/zitadel/pull/9771

## Follow-ups

- Metadata: support managing user metadata using resource API
https://github.com/zitadel/zitadel/pull/10005
- Machine token type: support managing the machine token type (migrate
to new enum with zero value unspecified?)

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Livio Spring <[email protected]>
2025-06-04 07:17:23 +00:00

71 lines
2.4 KiB
Protocol Buffer

syntax = "proto3";
package zitadel.user.v2;
option go_package = "github.com/zitadel/zitadel/pkg/grpc/user/v2;user";
import "protoc-gen-openapiv2/options/annotations.proto";
import "google/protobuf/timestamp.proto";
import "validate/validate.proto";
import "zitadel/filter/v2/filter.proto";
message PersonalAccessToken {
// The timestamp of the personal access token creation.
google.protobuf.Timestamp creation_date = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"2024-12-18T07:50:47.492Z\"";
}
];
// The timestamp of the last change of the personal access token.
google.protobuf.Timestamp change_date = 2 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"2024-12-18T07:50:47.492Z\"";
}
];
// The unique identifier of the personal access token.
string id = 3 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"69629012906488334\"";
}
];
// The unique identifier of the user the personal access token belongs to.
string user_id = 4 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"69629012906488334\"";
}
];
// The unique identifier of the organization the personal access token belongs to.
string organization_id = 5 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"69629012906488334\"";
}
];
// The personal access tokens expiration date.
google.protobuf.Timestamp expiration_date = 6 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"2024-12-18T07:50:47.492Z\"";
}
];
}
message PersonalAccessTokensSearchFilter {
oneof filter {
option (validate.required) = true;
zitadel.filter.v2.IDFilter token_id_filter = 1;
zitadel.filter.v2.IDFilter user_id_filter = 2;
zitadel.filter.v2.IDFilter organization_id_filter = 3;
zitadel.filter.v2.TimestampFilter created_date_filter = 4;
zitadel.filter.v2.TimestampFilter expiration_date_filter = 5;
}
}
enum PersonalAccessTokenFieldName {
PERSONAL_ACCESS_TOKEN_FIELD_NAME_UNSPECIFIED = 0;
PERSONAL_ACCESS_TOKEN_FIELD_NAME_CREATED_DATE = 1;
PERSONAL_ACCESS_TOKEN_FIELD_NAME_ID = 2;
PERSONAL_ACCESS_TOKEN_FIELD_NAME_USER_ID = 3;
PERSONAL_ACCESS_TOKEN_FIELD_NAME_ORGANIZATION_ID = 4;
PERSONAL_ACCESS_TOKEN_FIELD_NAME_EXPIRATION_DATE = 5;
}