From ff8d081083cffab498e87a9c9a773a0184563679 Mon Sep 17 00:00:00 2001 From: Akshay Gaikwad Date: Fri, 2 Dec 2022 15:58:38 +0530 Subject: [PATCH] Add forceReset property in user spec Signed-off-by: Akshay Gaikwad --- gen/openapi/proto/rpc/user/user.swagger.json | 26 ++++ internal/provider/kratos/kratos.go | 50 ++++++- pkg/service/user.go | 10 +- proto/types/userpb/v3/user.pb.go | 143 +++++++++++-------- proto/types/userpb/v3/user.proto | 5 + 5 files changed, 165 insertions(+), 69 deletions(-) diff --git a/gen/openapi/proto/rpc/user/user.swagger.json b/gen/openapi/proto/rpc/user/user.swagger.json index dee057f..1fa169f 100644 --- a/gen/openapi/proto/rpc/user/user.swagger.json +++ b/gen/openapi/proto/rpc/user/user.swagger.json @@ -293,6 +293,13 @@ "required": false, "type": "string" }, + { + "name": "spec.forceReset", + "description": "ForceReset. This indicate user has auto generated password. Client should reset the user password.", + "in": "query", + "required": false, + "type": "boolean" + }, { "name": "status.conditionType", "description": "Condition Type\n\ntype of the status condition", @@ -530,6 +537,13 @@ "required": false, "type": "string" }, + { + "name": "spec.forceReset", + "description": "ForceReset. This indicate user has auto generated password. Client should reset the user password.", + "in": "query", + "required": false, + "type": "boolean" + }, { "name": "status.conditionType", "description": "Condition Type\n\ntype of the status condition", @@ -1052,6 +1066,13 @@ "required": false, "type": "string" }, + { + "name": "spec.forceReset", + "description": "ForceReset. This indicate user has auto generated password. Client should reset the user password.", + "in": "query", + "required": false, + "type": "boolean" + }, { "name": "status.conditionType", "description": "Condition Type\n\ntype of the status condition", @@ -1917,6 +1938,11 @@ "description": "Last access date time in RFC3339 format.", "title": "LastLogin", "readOnly": true + }, + "forceReset": { + "type": "boolean", + "description": "This indicate user has auto generated password. Client should reset the user password.", + "title": "ForceReset" } }, "description": "User specification", diff --git a/internal/provider/kratos/kratos.go b/internal/provider/kratos/kratos.go index b4bfab4..3a98314 100644 --- a/internal/provider/kratos/kratos.go +++ b/internal/provider/kratos/kratos.go @@ -2,36 +2,53 @@ package providers import ( "context" + "errors" "fmt" + "net/http" kclient "github.com/ory/kratos-client-go" ) +// IdentityPublicMetadata is an extra information of the +// user. Checkout +// https://www.ory.sh/docs/kratos/manage-identities/managing-users-identities-metadata +// for more information about Ory Kratos identity metadata. +type IdentityPublicMetadata struct { + // Indicate identity is created with auto generated password. + ForceReset bool +} + type kratosAuthProvider struct { kc *kclient.APIClient } type AuthProvider interface { // create new user - Create(context.Context, string, map[string]interface{}) (string, error) // returns id,error + Create(context.Context, string, map[string]interface{}, bool) (string, error) // returns id,error // update user - Update(context.Context, string, map[string]interface{}) error + Update(context.Context, string, map[string]interface{}, bool) error // get recovery link for user GetRecoveryLink(context.Context, string) (string, error) // delete user Delete(context.Context, string) error + // Get Public metadata of Kratos id. + GetPublicMetadata(context.Context, string) (*IdentityPublicMetadata, error) } func NewKratosAuthProvider(kc *kclient.APIClient) AuthProvider { return &kratosAuthProvider{kc: kc} } -func (k *kratosAuthProvider) Create(ctx context.Context, password string, traits map[string]interface{}) (string, error) { +func (k *kratosAuthProvider) Create(ctx context.Context, password string, traits map[string]interface{}, forceReset bool) (string, error) { cib := kclient.NewAdminCreateIdentityBody("default", traits) cib.Credentials.SetPassword(kclient.AdminCreateIdentityImportCredentialsPassword{ Config: &kclient.AdminCreateIdentityImportCredentialsPasswordConfig{ Password: kclient.PtrString(password), }, }) + ipm := IdentityPublicMetadata{ + ForceReset: forceReset, + } + cib.SetMetadataPublic(ipm) ir, hr, err := k.kc.V0alpha2Api.AdminCreateIdentity(ctx).AdminCreateIdentityBody(*cib).Execute() if err != nil { fmt.Println(hr) @@ -40,8 +57,12 @@ func (k *kratosAuthProvider) Create(ctx context.Context, password string, traits return ir.Id, nil } -func (k *kratosAuthProvider) Update(ctx context.Context, id string, traits map[string]interface{}) error { +func (k *kratosAuthProvider) Update(ctx context.Context, id string, traits map[string]interface{}, forceReset bool) error { uib := kclient.NewAdminUpdateIdentityBody("default", "active", traits) + ipm := IdentityPublicMetadata{ + ForceReset: forceReset, + } + uib.SetMetadataPublic(ipm) _, hr, err := k.kc.V0alpha2Api.AdminUpdateIdentity(ctx, id).AdminUpdateIdentityBody(*uib).Execute() if err != nil { fmt.Println(hr) @@ -65,3 +86,24 @@ func (k *kratosAuthProvider) Delete(ctx context.Context, id string) error { } return err } + +func (k *kratosAuthProvider) GetPublicMetadata(ctx context.Context, id string) (*IdentityPublicMetadata, error) { + identity, res, err := k.kc.V0alpha2Api.AdminGetIdentity(ctx, id).Execute() + if err != nil { + return nil, err + } + if res.StatusCode != http.StatusOK { + return nil, errors.New("Failed to get identity") + } + ipm := &IdentityPublicMetadata{} + if identity.HasMetadataPublic() { + meta := identity.GetMetadataPublic() + if m, ok := meta.(map[string]interface{}); ok { + fr, ok := m["ForceReset"].(bool) + if ok { + ipm.ForceReset = fr + } + } + } + return ipm, nil +} diff --git a/pkg/service/user.go b/pkg/service/user.go index 5ce823e..fa0bb37 100644 --- a/pkg/service/user.go +++ b/pkg/service/user.go @@ -423,7 +423,7 @@ func (s *userService) Create(ctx context.Context, user *userv3.User) (*userv3.Us "email": user.GetMetadata().GetName(), // can be just username for API access "first_name": user.GetSpec().GetFirstName(), "last_name": user.GetSpec().GetLastName(), - }) + }, user.Spec.ForceReset) if err != nil { return &userv3.User{}, err } @@ -552,6 +552,12 @@ func (s *userService) GetByName(ctx context.Context, user *userv3.User) (*userv3 user.GetSpec().LastLogin = lastLogin } + meta, err := s.ap.GetPublicMetadata(ctx, usr.ID.String()) + if err != nil { + return &userv3.User{}, err + } + user.Spec.ForceReset = meta.ForceReset + return user, nil } return user, nil @@ -693,7 +699,7 @@ func (s *userService) Update(ctx context.Context, user *userv3.User) (*userv3.Us "email": user.GetMetadata().GetName(), "first_name": user.GetSpec().GetFirstName(), "last_name": user.GetSpec().GetLastName(), - }) + }, user.Spec.ForceReset) if err != nil { return &userv3.User{}, err } diff --git a/proto/types/userpb/v3/user.pb.go b/proto/types/userpb/v3/user.pb.go index f0e0330..8e1b633 100644 --- a/proto/types/userpb/v3/user.pb.go +++ b/proto/types/userpb/v3/user.pb.go @@ -299,6 +299,7 @@ type UserSpec struct { PhoneVerified bool `protobuf:"varint,10,opt,name=phoneVerified,proto3" json:"phoneVerified,omitempty"` RecoveryUrl *string `protobuf:"bytes,11,opt,name=recoveryUrl,proto3,oneof" json:"recoveryUrl,omitempty"` LastLogin string `protobuf:"bytes,12,opt,name=lastLogin,proto3" json:"lastLogin,omitempty"` + ForceReset bool `protobuf:"varint,13,opt,name=forceReset,proto3" json:"forceReset,omitempty"` } func (x *UserSpec) Reset() { @@ -410,6 +411,13 @@ func (x *UserSpec) GetLastLogin() string { return "" } +func (x *UserSpec) GetForceReset() bool { + if x != nil { + return x.ForceReset + } + return false +} + type UserList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -674,8 +682,8 @@ var file_proto_types_userpb_v3_user_proto_rawDesc = []byte{ 0x74, 0x61, 0x74, 0x75, 0x73, 0x3a, 0x37, 0x92, 0x41, 0x34, 0x0a, 0x32, 0x2a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x32, 0x04, 0x55, 0x73, 0x65, 0x72, 0xd2, 0x01, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0xd2, 0x01, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0xd2, 0x01, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xd2, 0x01, 0x04, 0x73, 0x70, 0x65, 0x63, 0x22, 0xbe, - 0x08, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x12, 0x44, 0x0a, 0x09, 0x66, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xd2, 0x01, 0x04, 0x73, 0x70, 0x65, 0x63, 0x22, 0xc8, + 0x09, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x12, 0x44, 0x0a, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x26, 0x92, 0x41, 0x23, 0x2a, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x32, 0x16, 0x46, 0x69, 0x72, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, @@ -739,67 +747,76 @@ var file_proto_types_userpb_v3_user_proto_rawDesc = []byte{ 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x20, 0x64, 0x61, 0x74, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x52, 0x46, 0x43, 0x33, 0x33, 0x33, 0x39, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x40, 0x01, 0x52, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x69, 0x6e, - 0x3a, 0x2d, 0x92, 0x41, 0x2a, 0x0a, 0x28, 0x2a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x20, 0x53, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x12, 0x55, 0x73, 0x65, - 0x72, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, - 0x0e, 0x0a, 0x0c, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x55, 0x72, 0x6c, 0x22, - 0xc3, 0x03, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x71, 0x0a, 0x0a, - 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x51, 0x92, 0x41, 0x4e, 0x2a, 0x0b, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x32, 0x25, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, - 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x6c, 0x69, 0x73, 0x74, - 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x16, 0x75, 0x73, 0x65, 0x72, 0x6d, - 0x67, 0x6d, 0x74, 0x2e, 0x6b, 0x38, 0x73, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x69, 0x6f, 0x2f, 0x76, - 0x33, 0x40, 0x01, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x49, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x35, 0x92, - 0x41, 0x32, 0x2a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x32, 0x1e, 0x4b, 0x69, 0x6e, 0x64, 0x20, 0x6f, - 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, - 0x73, 0x74, 0x40, 0x01, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x7a, 0x0a, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, - 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x33, 0x92, 0x41, 0x30, 0x2a, 0x08, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x32, 0x22, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x6c, 0x69, 0x73, - 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x5f, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, - 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, - 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, - 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x42, 0x28, 0x92, 0x41, 0x25, 0x2a, 0x05, 0x49, 0x74, 0x65, - 0x6d, 0x73, 0x32, 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, - 0x75, 0x73, 0x65, 0x72, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x40, 0x01, - 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x3a, 0x1c, 0x92, 0x41, 0x19, 0x0a, 0x17, 0x2a, 0x08, - 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x32, 0x09, 0x55, 0x73, 0x65, 0x72, 0x20, 0x6c, - 0x69, 0x73, 0x74, 0x40, 0x01, 0x22, 0xcc, 0x01, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, - 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x0f, 0x92, 0x41, 0x0c, 0x2a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x32, 0x04, 0x55, 0x73, 0x65, - 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0x92, 0x41, 0x0c, 0x2a, 0x04, 0x52, 0x6f, 0x6c, 0x65, - 0x32, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x37, 0x0a, 0x09, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x19, 0x92, 0x41, 0x16, 0x2a, 0x09, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x32, - 0x09, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x3a, 0x3d, 0x92, 0x41, 0x3a, 0x0a, 0x38, 0x2a, 0x08, 0x55, 0x73, - 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x32, 0x2c, 0x55, 0x73, 0x65, 0x72, 0x2c, 0x20, 0x72, 0x6f, - 0x6c, 0x65, 0x2c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x70, 0x61, - 0x69, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x42, 0xec, 0x01, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x61, 0x72, - 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, - 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x09, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x75, 0x73, 0x65, 0x72, - 0x70, 0x62, 0x2f, 0x76, 0x33, 0x3b, 0x75, 0x73, 0x65, 0x72, 0x76, 0x33, 0xa2, 0x02, 0x04, 0x50, - 0x44, 0x54, 0x55, 0xaa, 0x02, 0x19, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x44, 0x65, - 0x76, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x56, 0x33, 0xca, - 0x02, 0x19, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x54, 0x79, - 0x70, 0x65, 0x73, 0x5c, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x33, 0xe2, 0x02, 0x25, 0x50, 0x61, - 0x72, 0x61, 0x6c, 0x75, 0x73, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, - 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x33, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x1d, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x3a, 0x3a, 0x44, - 0x65, 0x76, 0x3a, 0x3a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x3a, 0x3a, 0x55, 0x73, 0x65, 0x72, 0x3a, - 0x3a, 0x56, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x87, 0x01, 0x0a, 0x0a, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x65, 0x74, 0x18, + 0x0d, 0x20, 0x01, 0x28, 0x08, 0x42, 0x67, 0x92, 0x41, 0x64, 0x2a, 0x0a, 0x46, 0x6f, 0x72, 0x63, + 0x65, 0x52, 0x65, 0x73, 0x65, 0x74, 0x32, 0x56, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x64, + 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x68, 0x61, 0x73, 0x20, 0x61, + 0x75, 0x74, 0x6f, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x2e, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x73, + 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x72, 0x65, 0x73, 0x65, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x75, 0x73, 0x65, 0x72, 0x20, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x2e, 0x52, 0x0a, + 0x66, 0x6f, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x65, 0x74, 0x3a, 0x2d, 0x92, 0x41, 0x2a, 0x0a, + 0x28, 0x2a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x20, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x12, 0x55, 0x73, 0x65, 0x72, 0x20, 0x73, 0x70, 0x65, 0x63, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x72, 0x65, + 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x55, 0x72, 0x6c, 0x22, 0xc3, 0x03, 0x0a, 0x08, 0x55, 0x73, + 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x71, 0x0a, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x51, 0x92, 0x41, 0x4e, 0x2a, + 0x0b, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0x25, 0x41, 0x50, + 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, + 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x3a, 0x16, 0x75, 0x73, 0x65, 0x72, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x6b, 0x38, + 0x73, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x33, 0x40, 0x01, 0x52, 0x0a, 0x61, + 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x04, 0x6b, 0x69, 0x6e, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x35, 0x92, 0x41, 0x32, 0x2a, 0x04, 0x4b, 0x69, + 0x6e, 0x64, 0x32, 0x1e, 0x4b, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x75, 0x73, 0x65, 0x72, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x3a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x40, 0x01, 0x52, 0x04, + 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x7a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, + 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x42, 0x33, 0x92, 0x41, 0x30, 0x2a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x32, 0x22, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, + 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x12, 0x5f, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, + 0x42, 0x28, 0x92, 0x41, 0x25, 0x2a, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x32, 0x1a, 0x4c, 0x69, + 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x40, 0x01, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, + 0x73, 0x3a, 0x1c, 0x92, 0x41, 0x19, 0x0a, 0x17, 0x2a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, + 0x73, 0x74, 0x32, 0x09, 0x55, 0x73, 0x65, 0x72, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x40, 0x01, 0x22, + 0xcc, 0x01, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x04, + 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0x92, 0x41, 0x0c, 0x2a, + 0x04, 0x55, 0x73, 0x65, 0x72, 0x32, 0x04, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, + 0x72, 0x12, 0x23, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x0f, 0x92, 0x41, 0x0c, 0x2a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x32, 0x04, 0x52, 0x6f, 0x6c, 0x65, + 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x37, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x19, 0x92, 0x41, 0x16, 0x2a, 0x09, + 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x32, 0x09, 0x4e, 0x61, 0x6d, 0x65, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x3a, + 0x3d, 0x92, 0x41, 0x3a, 0x0a, 0x38, 0x2a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, + 0x32, 0x2c, 0x55, 0x73, 0x65, 0x72, 0x2c, 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x2c, 0x20, 0x6e, 0x61, + 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x20, + 0x66, 0x6f, 0x72, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0xec, + 0x01, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, + 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, + 0x42, 0x09, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, + 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x70, 0x62, 0x2f, 0x76, 0x33, 0x3b, + 0x75, 0x73, 0x65, 0x72, 0x76, 0x33, 0xa2, 0x02, 0x04, 0x50, 0x44, 0x54, 0x55, 0xaa, 0x02, 0x19, + 0x50, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x44, 0x65, 0x76, 0x2e, 0x54, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x56, 0x33, 0xca, 0x02, 0x19, 0x50, 0x61, 0x72, 0x61, + 0x6c, 0x75, 0x73, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x55, 0x73, + 0x65, 0x72, 0x5c, 0x56, 0x33, 0xe2, 0x02, 0x25, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x5c, + 0x44, 0x65, 0x76, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, + 0x33, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1d, + 0x50, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x3a, 0x3a, 0x44, 0x65, 0x76, 0x3a, 0x3a, 0x54, 0x79, + 0x70, 0x65, 0x73, 0x3a, 0x3a, 0x55, 0x73, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x33, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/types/userpb/v3/user.proto b/proto/types/userpb/v3/user.proto index b0ce90c..2d69f2a 100644 --- a/proto/types/userpb/v3/user.proto +++ b/proto/types/userpb/v3/user.proto @@ -206,6 +206,11 @@ message UserSpec { description : "Last access date time in RFC3339 format." read_only : true } ]; + bool forceReset = 13 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "ForceReset" + description : "This indicate user has auto generated password. Client should reset the user password." + } ]; } message UserList {