Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: support service account creation in v1 (#4861)

Danny Xu9b5c37a06a85
diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.go
index d7b5f27608..c4b50b43ea 100644
--- a/backend/api/v1/auth_service.go
+++ b/backend/api/v1/auth_service.go
@@ -93,12 +93,11 @@ func (s *AuthService) CreateUser(ctx context.Context, request *v1pb.CreateUserRe
if request.User.Title == "" {
return nil, status.Errorf(codes.InvalidArgument, "user title must be set")
}
- if request.User.Password == "" {
- return nil, status.Errorf(codes.InvalidArgument, "password must be set")
+ if request.User.UserType != v1pb.UserType_SERVICE_ACCOUNT && request.User.UserType != v1pb.UserType_USER {
+ return nil, status.Errorf(codes.InvalidArgument, "support user and service account only")
}
- passwordHash, err := bcrypt.GenerateFromPassword([]byte(request.User.Password), bcrypt.DefaultCost)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to generate password hash, error: %v", err)
+ if request.User.UserType != v1pb.UserType_SERVICE_ACCOUNT && request.User.Password == "" {
+ return nil, status.Errorf(codes.InvalidArgument, "password must be set")
}
existingUsers, err := s.store.ListUsers(ctx, &store.FindUserMessage{
@@ -130,6 +129,18 @@ func (s *AuthService) CreateUser(ctx context.Context, request *v1pb.CreateUserRe
return nil, status.Errorf(codes.InvalidArgument, "email %s is already existed", request.User.Email)
}
+ password := request.User.Password
+ if request.User.UserType == v1pb.UserType_SERVICE_ACCOUNT {
+ pwd, err := common.RandomString(20)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to generate access key for service account.")
+ }
+ password = fmt.Sprintf("%s%s", api.ServiceAccountAccessKeyPrefix, pwd)
+ }
+ passwordHash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to generate password hash, error: %v", err)
+ }
user, err := s.store.CreateUser(ctx, &store.UserMessage{
Email: request.User.Email,
Name: request.User.Title,
@@ -178,7 +189,11 @@ func (s *AuthService) CreateUser(ctx context.Context, request *v1pb.CreateUserRe
if _, err := s.store.CreateActivity(ctx, activityCreate); err != nil {
return nil, status.Errorf(codes.Internal, "failed to create activity, error: %v", err)
}
- return convertToUser(user), nil
+ userResponse := convertToUser(user)
+ if request.User.UserType == v1pb.UserType_SERVICE_ACCOUNT {
+ userResponse.ServiceKey = password
+ }
+ return userResponse, nil
}
// UpdateUser updates a user.
@@ -211,6 +226,7 @@ func (s *AuthService) UpdateUser(ctx context.Context, request *v1pb.UpdateUserRe
return nil, status.Errorf(codes.PermissionDenied, "only workspace owner or user itself can update the user %d", userID)
}
+ var passwordPatch *string
patch := &store.UpdateUserMessage{}
for _, path := range request.UpdateMask.Paths {
switch path {
@@ -232,12 +248,20 @@ func (s *AuthService) UpdateUser(ctx context.Context, request *v1pb.UpdateUserRe
case "user.title":
patch.Name = &request.User.Title
case "user.password":
- passwordHash, err := bcrypt.GenerateFromPassword([]byte(request.User.Password), bcrypt.DefaultCost)
+ if user.Type != api.EndUser {
+ return nil, status.Errorf(codes.InvalidArgument, "password can be mutated for end users only")
+ }
+ passwordPatch = &request.User.Password
+ case "user.service_key":
+ if user.Type != api.ServiceAccount {
+ return nil, status.Errorf(codes.InvalidArgument, "service key can be mutated for service accounts only")
+ }
+ val, err := common.RandomString(20)
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to generate password hash, error: %v", err)
+ return nil, status.Errorf(codes.Internal, "failed to generate access key for service account.")
}
- passwordHashStr := string(passwordHash)
- patch.PasswordHash = &passwordHashStr
+ password := fmt.Sprintf("%s%s", api.ServiceAccountAccessKeyPrefix, val)
+ passwordPatch = &password
case "user.role":
if role != api.Owner {
return nil, status.Errorf(codes.PermissionDenied, "only workspace owner can update user role")
@@ -249,12 +273,25 @@ func (s *AuthService) UpdateUser(ctx context.Context, request *v1pb.UpdateUserRe
patch.Role = &userRole
}
}
+ if passwordPatch != nil {
+ passwordHash, err := bcrypt.GenerateFromPassword([]byte(request.User.Password), bcrypt.DefaultCost)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to generate password hash, error: %v", err)
+ }
+ passwordHashStr := string(passwordHash)
+ patch.PasswordHash = &passwordHashStr
+ }
user, err = s.store.UpdateUser(ctx, userID, patch, principalID)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to update user, error: %v", err)
}
- return convertToUser(user), nil
+
+ userResponse := convertToUser(user)
+ if request.User.UserType == v1pb.UserType_SERVICE_ACCOUNT && passwordPatch != nil {
+ userResponse.ServiceKey = *passwordPatch
+ }
+ return userResponse, nil
}
// DeleteUser deletes a user.
diff --git a/backend/legacyapi/principal.go b/backend/legacyapi/principal.go
index 442bfcfe2b..c02fcea59f 100644
--- a/backend/legacyapi/principal.go
+++ b/backend/legacyapi/principal.go
@@ -23,6 +23,9 @@ const (
// PrincipalIDForFirstUser is the principal id for the first user in workspace.
PrincipalIDForFirstUser = 101
+
+ // ServiceAccountAccessKeyPrefix is the prefix for service account access key.
+ ServiceAccountAccessKeyPrefix = "bbs_"
)
// PrincipalAuthProvider is the type of an authentication provider.
diff --git a/backend/server/principal.go b/backend/server/principal.go
index afa0072f9f..f112a4c185 100644
--- a/backend/server/principal.go
+++ b/backend/server/principal.go
@@ -19,9 +19,6 @@ import (
"github.com/bytebase/bytebase/backend/store"
)
-// serviceAccountAccessKeyPrefix is the prefix for service account access key.
-const serviceAccountAccessKeyPrefix = "bbs_"
-
func (s *Server) registerPrincipalRoutes(g *echo.Group) {
g.POST("/principal", func(c echo.Context) error {
ctx := c.Request().Context()
@@ -44,7 +41,7 @@ func (s *Server) registerPrincipalRoutes(g *echo.Group) {
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to generate access key for service account.").SetInternal(err)
}
- password = fmt.Sprintf("%s%s", serviceAccountAccessKeyPrefix, pwd)
+ password = fmt.Sprintf("%s%s", api.ServiceAccountAccessKeyPrefix, pwd)
}
passwordHash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
if err != nil {
@@ -189,7 +186,7 @@ func (s *Server) registerPrincipalRoutes(g *echo.Group) {
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to generate access key for service account.").SetInternal(err)
}
- password := fmt.Sprintf("%s%s", serviceAccountAccessKeyPrefix, val)
+ password := fmt.Sprintf("%s%s", api.ServiceAccountAccessKeyPrefix, val)
newPassword = &password
}
if newPassword != nil && *newPassword != "" {
diff --git a/backend/tests/tests.go b/backend/tests/tests.go
index c8888cf278..1550d0aa4e 100644
--- a/backend/tests/tests.go
+++ b/backend/tests/tests.go
@@ -622,7 +622,7 @@ func (ctl *controller) Signup() error {
resp, err := ctl.client.Post(
fmt.Sprintf("%s/users", ctl.v1APIURL),
"",
- strings.NewReader(`{"email":"[email protected]","password":"1024","title":"demo"}`),
+ strings.NewReader(`{"email":"[email protected]","password":"1024","title":"demo","user_type":"USER"}`),
)
if err != nil {
return errors.Wrap(err, "fail to post login request")
diff --git a/frontend/src/types/proto/v1/auth_service.ts b/frontend/src/types/proto/v1/auth_service.ts
index 510674c063..6bf6eff3f9 100644
--- a/frontend/src/types/proto/v1/auth_service.ts
+++ b/frontend/src/types/proto/v1/auth_service.ts
@@ -210,10 +210,11 @@ export interface User {
state: State;
email: string;
title: string;
- password: string;
userType: UserType;
/** The user role will not be respected in the create user request, because the role is controlled by workspace owner. */
userRole: UserRole;
+ password: string;
+ serviceKey: string;
}
function createBaseGetUserRequest(): GetUserRequest {
@@ -919,7 +920,7 @@ export const LogoutRequest = {
};
function createBaseUser(): User {
- return { name: "", state: 0, email: "", title: "", password: "", userType: 0, userRole: 0 };
+ return { name: "", state: 0, email: "", title: "", userType: 0, userRole: 0, password: "", serviceKey: "" };
}
export const User = {
@@ -936,14 +937,17 @@ export const User = {
if (message.title !== "") {
writer.uint32(34).string(message.title);
}
- if (message.password !== "") {
- writer.uint32(42).string(message.password);
- }
if (message.userType !== 0) {
- writer.uint32(48).int32(message.userType);
+ writer.uint32(40).int32(message.userType);
}
if (message.userRole !== 0) {
- writer.uint32(56).int32(message.userRole);
+ writer.uint32(48).int32(message.userRole);
+ }
+ if (message.password !== "") {
+ writer.uint32(58).string(message.password);
+ }
+ if (message.serviceKey !== "") {
+ writer.uint32(66).string(message.serviceKey);
}
return writer;
},
@@ -968,13 +972,16 @@ export const User = {
message.title = reader.string();
break;
case 5:
- message.password = reader.string();
+ message.userType = reader.int32() as any;
break;
case 6:
- message.userType = reader.int32() as any;
+ message.userRole = reader.int32() as any;
break;
case 7:
- message.userRole = reader.int32() as any;
+ message.password = reader.string();
+ break;
+ case 8:
+ message.serviceKey = reader.string();
break;
default:
reader.skipType(tag & 7);
@@ -990,9 +997,10 @@ export const User = {
state: isSet(object.state) ? stateFromJSON(object.state) : 0,
email: isSet(object.email) ? String(object.email) : "",
title: isSet(object.title) ? String(object.title) : "",
- password: isSet(object.password) ? String(object.password) : "",
userType: isSet(object.userType) ? userTypeFromJSON(object.userType) : 0,
userRole: isSet(object.userRole) ? userRoleFromJSON(object.userRole) : 0,
+ password: isSet(object.password) ? String(object.password) : "",
+ serviceKey: isSet(object.serviceKey) ? String(object.serviceKey) : "",
};
},
@@ -1002,9 +1010,10 @@ export const User = {
message.state !== undefined && (obj.state = stateToJSON(message.state));
message.email !== undefined && (obj.email = message.email);
message.title !== undefined && (obj.title = message.title);
- message.password !== undefined && (obj.password = message.password);
message.userType !== undefined && (obj.userType = userTypeToJSON(message.userType));
message.userRole !== undefined && (obj.userRole = userRoleToJSON(message.userRole));
+ message.password !== undefined && (obj.password = message.password);
+ message.serviceKey !== undefined && (obj.serviceKey = message.serviceKey);
return obj;
},
@@ -1014,9 +1023,10 @@ export const User = {
message.state = object.state ?? 0;
message.email = object.email ?? "";
message.title = object.title ?? "";
- message.password = object.password ?? "";
message.userType = object.userType ?? 0;
message.userRole = object.userRole ?? 0;
+ message.password = object.password ?? "";
+ message.serviceKey = object.serviceKey ?? "";
return message;
},
};
diff --git a/proto/generated-go/v1/auth_service.pb.go b/proto/generated-go/v1/auth_service.pb.go
index d88d5dd43f..3a0c41f08e 100644
--- a/proto/generated-go/v1/auth_service.pb.go
+++ b/proto/generated-go/v1/auth_service.pb.go
@@ -859,10 +859,11 @@ type User struct {
State State `protobuf:"varint,2,opt,name=state,proto3,enum=bytebase.v1.State" json:"state,omitempty"`
Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"`
- Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"`
- UserType UserType `protobuf:"varint,6,opt,name=user_type,json=userType,proto3,enum=bytebase.v1.UserType" json:"user_type,omitempty"`
+ UserType UserType `protobuf:"varint,5,opt,name=user_type,json=userType,proto3,enum=bytebase.v1.UserType" json:"user_type,omitempty"`
// The user role will not be respected in the create user request, because the role is controlled by workspace owner.
- UserRole UserRole `protobuf:"varint,7,opt,name=user_role,json=userRole,proto3,enum=bytebase.v1.UserRole" json:"user_role,omitempty"`
+ UserRole UserRole `protobuf:"varint,6,opt,name=user_role,json=userRole,proto3,enum=bytebase.v1.UserRole" json:"user_role,omitempty"`
+ Password string `protobuf:"bytes,7,opt,name=password,proto3" json:"password,omitempty"`
+ ServiceKey string `protobuf:"bytes,8,opt,name=service_key,json=serviceKey,proto3" json:"service_key,omitempty"`
}
func (x *User) Reset() {
@@ -925,13 +926,6 @@ func (x *User) GetTitle() string {
return ""
}
-func (x *User) GetPassword() string {
- if x != nil {
- return x.Password
- }
- return ""
-}
-
func (x *User) GetUserType() UserType {
if x != nil {
return x.UserType
@@ -946,6 +940,20 @@ func (x *User) GetUserRole() UserRole {
return UserRole_USER_ROLE_UNSPECIFIED
}
+func (x *User) GetPassword() string {
+ if x != nil {
+ return x.Password
+ }
+ return ""
+}
+
+func (x *User) GetServiceKey() string {
+ if x != nil {
+ return x.ServiceKey
+ }
+ return ""
+}
+
var File_v1_auth_service_proto protoreflect.FileDescriptor
var file_v1_auth_service_proto_rawDesc = []byte{
@@ -1031,86 +1039,89 @@ var file_v1_auth_service_proto_rawDesc = []byte{
0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f,
0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e,
0x22, 0x0f, 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x22, 0x80, 0x02, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61,
+ 0x74, 0x22, 0xa7, 0x02, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,
0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14,
0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65,
0x6d, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x04, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x08, 0x70, 0x61,
- 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41,
- 0x01, 0x04, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x32, 0x0a, 0x09,
- 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32,
- 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73,
- 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65,
- 0x12, 0x32, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x07, 0x20,
- 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,
- 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72,
- 0x52, 0x6f, 0x6c, 0x65, 0x2a, 0x54, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65,
- 0x12, 0x19, 0x0a, 0x15, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e,
- 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55,
- 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x5f,
- 0x42, 0x4f, 0x54, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45,
- 0x5f, 0x41, 0x43, 0x43, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x03, 0x2a, 0x48, 0x0a, 0x08, 0x55, 0x73,
- 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x52,
- 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10,
- 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03,
- 0x44, 0x42, 0x41, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x45, 0x56, 0x45, 0x4c, 0x4f, 0x50,
- 0x45, 0x52, 0x10, 0x03, 0x32, 0xba, 0x06, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72,
- 0x76, 0x69, 0x63, 0x65, 0x12, 0x5c, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12,
- 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,
- 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x62,
- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22,
- 0x21, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12,
- 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f,
- 0x2a, 0x7d, 0x12, 0x66, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12,
- 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69,
- 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e,
- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73,
- 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a,
- 0xda, 0x41, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x12,
- 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x5f, 0x0a, 0x0a, 0x43, 0x72,
- 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65,
+ 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x32, 0x0a, 0x09, 0x75, 0x73,
+ 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e,
+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72,
+ 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x32,
+ 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28,
+ 0x0e, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
+ 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x52, 0x6f,
+ 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x07,
+ 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x04, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73,
+ 0x77, 0x6f, 0x72, 0x64, 0x12, 0x25, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f,
+ 0x6b, 0x65, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x04, 0x52,
+ 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4b, 0x65, 0x79, 0x2a, 0x54, 0x0a, 0x08, 0x55,
+ 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x53, 0x45, 0x52, 0x5f,
+ 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44,
+ 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a,
+ 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x5f, 0x42, 0x4f, 0x54, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f,
+ 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x41, 0x43, 0x43, 0x4f, 0x55, 0x4e, 0x54, 0x10,
+ 0x03, 0x2a, 0x48, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x19, 0x0a,
+ 0x15, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45,
+ 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4f, 0x57, 0x4e, 0x45,
+ 0x52, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x42, 0x41, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09,
+ 0x44, 0x45, 0x56, 0x45, 0x4c, 0x4f, 0x50, 0x45, 0x52, 0x10, 0x03, 0x32, 0xba, 0x06, 0x0a, 0x0b,
+ 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5c, 0x0a, 0x07, 0x47,
+ 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,
+ 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x21, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82,
+ 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65,
+ 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x66, 0x0a, 0x09, 0x4c, 0x69, 0x73,
+ 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,
+ 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0xda, 0x41, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74,
+ 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x12, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72,
+ 0x73, 0x12, 0x5f, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12,
+ 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72,
+ 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
+ 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73,
+ 0x65, 0x72, 0x22, 0x1e, 0xda, 0x41, 0x04, 0x75, 0x73, 0x65, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02,
+ 0x11, 0x3a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65,
+ 0x72, 0x73, 0x12, 0x79, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72,
+ 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55,
+ 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x1a, 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55,
+ 0x73, 0x65, 0x72, 0x22, 0x38, 0xda, 0x41, 0x10, 0x75, 0x73, 0x65, 0x72, 0x2c, 0x75, 0x70, 0x64,
+ 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x04,
+ 0x75, 0x73, 0x65, 0x72, 0x32, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x2e,
+ 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x67, 0x0a,
+ 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x62, 0x79,
+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
+ 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f,
+ 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d,
+ 0x70, 0x74, 0x79, 0x22, 0x21, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93,
+ 0x02, 0x14, 0x2a, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73,
+ 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6b, 0x0a, 0x0c, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65,
+ 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65,
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x1e, 0xda, 0x41, 0x04,
- 0x75, 0x73, 0x65, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x3a, 0x04, 0x75, 0x73, 0x65, 0x72,
- 0x22, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x79, 0x0a, 0x0a, 0x55,
- 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65,
- 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73,
- 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65,
- 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x38, 0xda, 0x41,
- 0x10, 0x75, 0x73, 0x65, 0x72, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73,
- 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x32, 0x17, 0x2f,
- 0x76, 0x31, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73,
- 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x67, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
- 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,
- 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71,
+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x26, 0x82, 0xd3, 0xe4,
+ 0x93, 0x02, 0x20, 0x3a, 0x01, 0x2a, 0x22, 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d,
+ 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x75, 0x6e, 0x64, 0x65, 0x6c,
+ 0x65, 0x74, 0x65, 0x12, 0x59, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x19, 0x2e, 0x62,
+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e,
+ 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x58,
+ 0x0a, 0x06, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
- 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x21, 0xda, 0x41,
- 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12, 0x2f, 0x76, 0x31,
- 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12,
- 0x6b, 0x0a, 0x0c, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12,
- 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x6e,
- 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x1a, 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
- 0x55, 0x73, 0x65, 0x72, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x3a, 0x01, 0x2a, 0x22,
- 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73,
- 0x2f, 0x2a, 0x7d, 0x3a, 0x75, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x59, 0x0a, 0x05,
- 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,
- 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
- 0x1a, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c,
- 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3,
- 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74,
- 0x68, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x58, 0x0a, 0x06, 0x4c, 0x6f, 0x67, 0x6f, 0x75,
- 0x74, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
- 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e,
- 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
- 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a,
- 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x6c, 0x6f, 0x67, 0x6f, 0x75,
- 0x74, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67,
- 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1a, 0x82, 0xd3,
+ 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74,
+ 0x68, 0x2f, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65,
+ 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x33,
}
var (
diff --git a/proto/v1/auth_service.proto b/proto/v1/auth_service.proto
index b603151440..325c47fe30 100644
--- a/proto/v1/auth_service.proto
+++ b/proto/v1/auth_service.proto
@@ -183,12 +183,14 @@ message User {
string title = 4;
- string password = 5 [(google.api.field_behavior) = INPUT_ONLY];
-
- UserType user_type = 6;
+ UserType user_type = 5;
// The user role will not be respected in the create user request, because the role is controlled by workspace owner.
- UserRole user_role = 7;
+ UserRole user_role = 6;
+
+ string password = 7 [(google.api.field_behavior) = INPUT_ONLY];
+
+ string service_key = 8 [(google.api.field_behavior) = INPUT_ONLY];
}
enum UserType {