From b9a32e41bffed850bdb9d0cc2b1370df37d13c10 Mon Sep 17 00:00:00 2001 From: Arnaud Delcasse Date: Tue, 6 Sep 2022 15:03:39 +0200 Subject: [PATCH] Templayte updates and small changes --- grpcapi/comasvc.pb.go | 376 ++++++++++++------ grpcapi/comasvc.proto | 10 +- grpcapi/comasvc_grpc.pb.go | 36 ++ grpcapi/grpcapi.go | 13 + handlers/accounts.go | 5 + oidc-provider/templates/parcoursmob/auth.html | 73 ++++ 6 files changed, 387 insertions(+), 126 deletions(-) create mode 100644 oidc-provider/templates/parcoursmob/auth.html diff --git a/grpcapi/comasvc.pb.go b/grpcapi/comasvc.pb.go index e43de4a..04484fc 100644 --- a/grpcapi/comasvc.pb.go +++ b/grpcapi/comasvc.pb.go @@ -325,9 +325,7 @@ type GetAccountRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,9,opt,name=id,proto3" json:"id,omitempty"` - Username string `protobuf:"bytes,10,opt,name=username,proto3" json:"username,omitempty"` - Namespace string `protobuf:"bytes,11,opt,name=namespace,proto3" json:"namespace,omitempty"` + Id string `protobuf:"bytes,9,opt,name=id,proto3" json:"id,omitempty"` } func (x *GetAccountRequest) Reset() { @@ -369,20 +367,6 @@ func (x *GetAccountRequest) GetId() string { return "" } -func (x *GetAccountRequest) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *GetAccountRequest) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - type GetAccountResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -430,6 +414,108 @@ func (x *GetAccountResponse) GetAccount() *Account { return nil } +type GetAccountUsernameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,10,opt,name=username,proto3" json:"username,omitempty"` + Namespace string `protobuf:"bytes,11,opt,name=namespace,proto3" json:"namespace,omitempty"` +} + +func (x *GetAccountUsernameRequest) Reset() { + *x = GetAccountUsernameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_comasvc_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAccountUsernameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAccountUsernameRequest) ProtoMessage() {} + +func (x *GetAccountUsernameRequest) ProtoReflect() protoreflect.Message { + mi := &file_comasvc_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAccountUsernameRequest.ProtoReflect.Descriptor instead. +func (*GetAccountUsernameRequest) Descriptor() ([]byte, []int) { + return file_comasvc_proto_rawDescGZIP(), []int{8} +} + +func (x *GetAccountUsernameRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *GetAccountUsernameRequest) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +type GetAccountUsernameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Account *Account `protobuf:"bytes,12,opt,name=account,proto3" json:"account,omitempty"` +} + +func (x *GetAccountUsernameResponse) Reset() { + *x = GetAccountUsernameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_comasvc_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAccountUsernameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAccountUsernameResponse) ProtoMessage() {} + +func (x *GetAccountUsernameResponse) ProtoReflect() protoreflect.Message { + mi := &file_comasvc_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAccountUsernameResponse.ProtoReflect.Descriptor instead. +func (*GetAccountUsernameResponse) Descriptor() ([]byte, []int) { + return file_comasvc_proto_rawDescGZIP(), []int{9} +} + +func (x *GetAccountUsernameResponse) GetAccount() *Account { + if x != nil { + return x.Account + } + return nil +} + type GetAccountsRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -441,7 +527,7 @@ type GetAccountsRequest struct { func (x *GetAccountsRequest) Reset() { *x = GetAccountsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_comasvc_proto_msgTypes[8] + mi := &file_comasvc_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -454,7 +540,7 @@ func (x *GetAccountsRequest) String() string { func (*GetAccountsRequest) ProtoMessage() {} func (x *GetAccountsRequest) ProtoReflect() protoreflect.Message { - mi := &file_comasvc_proto_msgTypes[8] + mi := &file_comasvc_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -467,7 +553,7 @@ func (x *GetAccountsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAccountsRequest.ProtoReflect.Descriptor instead. func (*GetAccountsRequest) Descriptor() ([]byte, []int) { - return file_comasvc_proto_rawDescGZIP(), []int{8} + return file_comasvc_proto_rawDescGZIP(), []int{10} } func (x *GetAccountsRequest) GetNamespaces() []string { @@ -488,7 +574,7 @@ type GetAccountsResponse struct { func (x *GetAccountsResponse) Reset() { *x = GetAccountsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_comasvc_proto_msgTypes[9] + mi := &file_comasvc_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -501,7 +587,7 @@ func (x *GetAccountsResponse) String() string { func (*GetAccountsResponse) ProtoMessage() {} func (x *GetAccountsResponse) ProtoReflect() protoreflect.Message { - mi := &file_comasvc_proto_msgTypes[9] + mi := &file_comasvc_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -514,7 +600,7 @@ func (x *GetAccountsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAccountsResponse.ProtoReflect.Descriptor instead. func (*GetAccountsResponse) Descriptor() ([]byte, []int) { - return file_comasvc_proto_rawDescGZIP(), []int{9} + return file_comasvc_proto_rawDescGZIP(), []int{11} } func (x *GetAccountsResponse) GetAccounts() []*Account { @@ -535,7 +621,7 @@ type GetAccountsBatchRequest struct { func (x *GetAccountsBatchRequest) Reset() { *x = GetAccountsBatchRequest{} if protoimpl.UnsafeEnabled { - mi := &file_comasvc_proto_msgTypes[10] + mi := &file_comasvc_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -548,7 +634,7 @@ func (x *GetAccountsBatchRequest) String() string { func (*GetAccountsBatchRequest) ProtoMessage() {} func (x *GetAccountsBatchRequest) ProtoReflect() protoreflect.Message { - mi := &file_comasvc_proto_msgTypes[10] + mi := &file_comasvc_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -561,7 +647,7 @@ func (x *GetAccountsBatchRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAccountsBatchRequest.ProtoReflect.Descriptor instead. func (*GetAccountsBatchRequest) Descriptor() ([]byte, []int) { - return file_comasvc_proto_rawDescGZIP(), []int{10} + return file_comasvc_proto_rawDescGZIP(), []int{12} } func (x *GetAccountsBatchRequest) GetAccountids() []string { @@ -582,7 +668,7 @@ type GetAccountsBatchResponse struct { func (x *GetAccountsBatchResponse) Reset() { *x = GetAccountsBatchResponse{} if protoimpl.UnsafeEnabled { - mi := &file_comasvc_proto_msgTypes[11] + mi := &file_comasvc_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -595,7 +681,7 @@ func (x *GetAccountsBatchResponse) String() string { func (*GetAccountsBatchResponse) ProtoMessage() {} func (x *GetAccountsBatchResponse) ProtoReflect() protoreflect.Message { - mi := &file_comasvc_proto_msgTypes[11] + mi := &file_comasvc_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -608,7 +694,7 @@ func (x *GetAccountsBatchResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAccountsBatchResponse.ProtoReflect.Descriptor instead. func (*GetAccountsBatchResponse) Descriptor() ([]byte, []int) { - return file_comasvc_proto_rawDescGZIP(), []int{11} + return file_comasvc_proto_rawDescGZIP(), []int{13} } func (x *GetAccountsBatchResponse) GetAccounts() []*Account { @@ -630,7 +716,7 @@ type ChangePasswordRequest struct { func (x *ChangePasswordRequest) Reset() { *x = ChangePasswordRequest{} if protoimpl.UnsafeEnabled { - mi := &file_comasvc_proto_msgTypes[12] + mi := &file_comasvc_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -643,7 +729,7 @@ func (x *ChangePasswordRequest) String() string { func (*ChangePasswordRequest) ProtoMessage() {} func (x *ChangePasswordRequest) ProtoReflect() protoreflect.Message { - mi := &file_comasvc_proto_msgTypes[12] + mi := &file_comasvc_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -656,7 +742,7 @@ func (x *ChangePasswordRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ChangePasswordRequest.ProtoReflect.Descriptor instead. func (*ChangePasswordRequest) Descriptor() ([]byte, []int) { - return file_comasvc_proto_rawDescGZIP(), []int{12} + return file_comasvc_proto_rawDescGZIP(), []int{14} } func (x *ChangePasswordRequest) GetId() string { @@ -682,7 +768,7 @@ type ChangePasswordResponse struct { func (x *ChangePasswordResponse) Reset() { *x = ChangePasswordResponse{} if protoimpl.UnsafeEnabled { - mi := &file_comasvc_proto_msgTypes[13] + mi := &file_comasvc_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -695,7 +781,7 @@ func (x *ChangePasswordResponse) String() string { func (*ChangePasswordResponse) ProtoMessage() {} func (x *ChangePasswordResponse) ProtoReflect() protoreflect.Message { - mi := &file_comasvc_proto_msgTypes[13] + mi := &file_comasvc_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -708,7 +794,7 @@ func (x *ChangePasswordResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ChangePasswordResponse.ProtoReflect.Descriptor instead. func (*ChangePasswordResponse) Descriptor() ([]byte, []int) { - return file_comasvc_proto_rawDescGZIP(), []int{13} + return file_comasvc_proto_rawDescGZIP(), []int{15} } var File_comasvc_proto protoreflect.FileDescriptor @@ -739,49 +825,60 @@ var file_comasvc_proto_rawDesc = []byte{ 0x6e, 0x74, 0x22, 0x38, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x5d, 0x0a, 0x11, + 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x23, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, - 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x38, 0x0a, 0x12, 0x47, - 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x22, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x34, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x22, 0x3b, 0x0a, 0x13, 0x47, - 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x24, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x0e, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x08, - 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x39, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x64, - 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x69, 0x64, 0x73, 0x22, 0x40, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x24, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x08, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x08, 0x61, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x43, 0x0a, 0x15, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, - 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x18, 0x0a, 0x16, 0x43, 0x68, - 0x61, 0x6e, 0x67, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xad, 0x03, 0x0a, 0x10, 0x4d, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, - 0x79, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x31, 0x0a, 0x08, 0x52, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x10, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, - 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0a, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x2e, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, - 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, + 0x64, 0x22, 0x38, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x55, 0x0a, 0x19, 0x47, + 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x22, 0x40, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x22, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x08, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x34, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x61, + 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x22, 0x3b, 0x0a, 0x13, 0x47, 0x65, + 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x24, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x0e, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x08, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x39, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x64, 0x73, + 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, + 0x64, 0x73, 0x22, 0x40, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, + 0x0a, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x08, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x08, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x22, 0x43, 0x0a, 0x15, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, + 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x18, 0x0a, 0x16, 0x43, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x32, 0xfe, 0x03, 0x0a, 0x10, 0x4d, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x31, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x12, 0x10, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0a, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4f, 0x0a, + 0x12, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1b, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, + 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, @@ -816,52 +913,57 @@ func file_comasvc_proto_rawDescGZIP() []byte { return file_comasvc_proto_rawDescData } -var file_comasvc_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_comasvc_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_comasvc_proto_goTypes = []interface{}{ - (*LoginRequest)(nil), // 0: LoginRequest - (*LoginResponse)(nil), // 1: LoginResponse - (*RegisterRequest)(nil), // 2: RegisterRequest - (*RegisterResponse)(nil), // 3: RegisterResponse - (*UpdateDataRequest)(nil), // 4: UpdateDataRequest - (*UpdateDataResponse)(nil), // 5: UpdateDataResponse - (*GetAccountRequest)(nil), // 6: GetAccountRequest - (*GetAccountResponse)(nil), // 7: GetAccountResponse - (*GetAccountsRequest)(nil), // 8: GetAccountsRequest - (*GetAccountsResponse)(nil), // 9: GetAccountsResponse - (*GetAccountsBatchRequest)(nil), // 10: GetAccountsBatchRequest - (*GetAccountsBatchResponse)(nil), // 11: GetAccountsBatchResponse - (*ChangePasswordRequest)(nil), // 12: ChangePasswordRequest - (*ChangePasswordResponse)(nil), // 13: ChangePasswordResponse - (*Account)(nil), // 14: Account + (*LoginRequest)(nil), // 0: LoginRequest + (*LoginResponse)(nil), // 1: LoginResponse + (*RegisterRequest)(nil), // 2: RegisterRequest + (*RegisterResponse)(nil), // 3: RegisterResponse + (*UpdateDataRequest)(nil), // 4: UpdateDataRequest + (*UpdateDataResponse)(nil), // 5: UpdateDataResponse + (*GetAccountRequest)(nil), // 6: GetAccountRequest + (*GetAccountResponse)(nil), // 7: GetAccountResponse + (*GetAccountUsernameRequest)(nil), // 8: GetAccountUsernameRequest + (*GetAccountUsernameResponse)(nil), // 9: GetAccountUsernameResponse + (*GetAccountsRequest)(nil), // 10: GetAccountsRequest + (*GetAccountsResponse)(nil), // 11: GetAccountsResponse + (*GetAccountsBatchRequest)(nil), // 12: GetAccountsBatchRequest + (*GetAccountsBatchResponse)(nil), // 13: GetAccountsBatchResponse + (*ChangePasswordRequest)(nil), // 14: ChangePasswordRequest + (*ChangePasswordResponse)(nil), // 15: ChangePasswordResponse + (*Account)(nil), // 16: Account } var file_comasvc_proto_depIdxs = []int32{ - 14, // 0: LoginResponse.account:type_name -> Account - 14, // 1: RegisterRequest.account:type_name -> Account - 14, // 2: RegisterResponse.account:type_name -> Account - 14, // 3: UpdateDataRequest.account:type_name -> Account - 14, // 4: UpdateDataResponse.account:type_name -> Account - 14, // 5: GetAccountResponse.account:type_name -> Account - 14, // 6: GetAccountsResponse.accounts:type_name -> Account - 14, // 7: GetAccountsBatchResponse.accounts:type_name -> Account - 2, // 8: MobilityAccounts.Register:input_type -> RegisterRequest - 4, // 9: MobilityAccounts.UpdateData:input_type -> UpdateDataRequest - 6, // 10: MobilityAccounts.GetAccount:input_type -> GetAccountRequest - 8, // 11: MobilityAccounts.GetAccounts:input_type -> GetAccountsRequest - 10, // 12: MobilityAccounts.GetAccountsBatch:input_type -> GetAccountsBatchRequest - 0, // 13: MobilityAccounts.Login:input_type -> LoginRequest - 12, // 14: MobilityAccounts.ChangePassword:input_type -> ChangePasswordRequest - 3, // 15: MobilityAccounts.Register:output_type -> RegisterResponse - 5, // 16: MobilityAccounts.UpdateData:output_type -> UpdateDataResponse - 7, // 17: MobilityAccounts.GetAccount:output_type -> GetAccountResponse - 9, // 18: MobilityAccounts.GetAccounts:output_type -> GetAccountsResponse - 11, // 19: MobilityAccounts.GetAccountsBatch:output_type -> GetAccountsBatchResponse - 1, // 20: MobilityAccounts.Login:output_type -> LoginResponse - 13, // 21: MobilityAccounts.ChangePassword:output_type -> ChangePasswordResponse - 15, // [15:22] is the sub-list for method output_type - 8, // [8:15] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 16, // 0: LoginResponse.account:type_name -> Account + 16, // 1: RegisterRequest.account:type_name -> Account + 16, // 2: RegisterResponse.account:type_name -> Account + 16, // 3: UpdateDataRequest.account:type_name -> Account + 16, // 4: UpdateDataResponse.account:type_name -> Account + 16, // 5: GetAccountResponse.account:type_name -> Account + 16, // 6: GetAccountUsernameResponse.account:type_name -> Account + 16, // 7: GetAccountsResponse.accounts:type_name -> Account + 16, // 8: GetAccountsBatchResponse.accounts:type_name -> Account + 2, // 9: MobilityAccounts.Register:input_type -> RegisterRequest + 4, // 10: MobilityAccounts.UpdateData:input_type -> UpdateDataRequest + 6, // 11: MobilityAccounts.GetAccount:input_type -> GetAccountRequest + 8, // 12: MobilityAccounts.GetAccountUsername:input_type -> GetAccountUsernameRequest + 10, // 13: MobilityAccounts.GetAccounts:input_type -> GetAccountsRequest + 12, // 14: MobilityAccounts.GetAccountsBatch:input_type -> GetAccountsBatchRequest + 0, // 15: MobilityAccounts.Login:input_type -> LoginRequest + 14, // 16: MobilityAccounts.ChangePassword:input_type -> ChangePasswordRequest + 3, // 17: MobilityAccounts.Register:output_type -> RegisterResponse + 5, // 18: MobilityAccounts.UpdateData:output_type -> UpdateDataResponse + 7, // 19: MobilityAccounts.GetAccount:output_type -> GetAccountResponse + 9, // 20: MobilityAccounts.GetAccountUsername:output_type -> GetAccountUsernameResponse + 11, // 21: MobilityAccounts.GetAccounts:output_type -> GetAccountsResponse + 13, // 22: MobilityAccounts.GetAccountsBatch:output_type -> GetAccountsBatchResponse + 1, // 23: MobilityAccounts.Login:output_type -> LoginResponse + 15, // 24: MobilityAccounts.ChangePassword:output_type -> ChangePasswordResponse + 17, // [17:25] is the sub-list for method output_type + 9, // [9:17] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_comasvc_proto_init() } @@ -968,7 +1070,7 @@ func file_comasvc_proto_init() { } } file_comasvc_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetAccountsRequest); i { + switch v := v.(*GetAccountUsernameRequest); i { case 0: return &v.state case 1: @@ -980,7 +1082,7 @@ func file_comasvc_proto_init() { } } file_comasvc_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetAccountsResponse); i { + switch v := v.(*GetAccountUsernameResponse); i { case 0: return &v.state case 1: @@ -992,7 +1094,7 @@ func file_comasvc_proto_init() { } } file_comasvc_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetAccountsBatchRequest); i { + switch v := v.(*GetAccountsRequest); i { case 0: return &v.state case 1: @@ -1004,7 +1106,7 @@ func file_comasvc_proto_init() { } } file_comasvc_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetAccountsBatchResponse); i { + switch v := v.(*GetAccountsResponse); i { case 0: return &v.state case 1: @@ -1016,7 +1118,7 @@ func file_comasvc_proto_init() { } } file_comasvc_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChangePasswordRequest); i { + switch v := v.(*GetAccountsBatchRequest); i { case 0: return &v.state case 1: @@ -1028,6 +1130,30 @@ func file_comasvc_proto_init() { } } file_comasvc_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAccountsBatchResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_comasvc_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChangePasswordRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_comasvc_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChangePasswordResponse); i { case 0: return &v.state @@ -1046,7 +1172,7 @@ func file_comasvc_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_comasvc_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 16, NumExtensions: 0, NumServices: 1, }, diff --git a/grpcapi/comasvc.proto b/grpcapi/comasvc.proto index 0ca83e5..d22bf87 100644 --- a/grpcapi/comasvc.proto +++ b/grpcapi/comasvc.proto @@ -10,6 +10,7 @@ service MobilityAccounts { rpc Register(RegisterRequest) returns (RegisterResponse) {} rpc UpdateData(UpdateDataRequest) returns (UpdateDataResponse) {} rpc GetAccount(GetAccountRequest) returns (GetAccountResponse) {} + rpc GetAccountUsername(GetAccountUsernameRequest) returns (GetAccountUsernameResponse) {} rpc GetAccounts(GetAccountsRequest) returns (GetAccountsResponse) {} rpc GetAccountsBatch(GetAccountsBatchRequest) returns (GetAccountsBatchResponse) {} @@ -46,11 +47,18 @@ message UpdateDataResponse { message GetAccountRequest { string id = 9; +} + +message GetAccountResponse { + Account account = 12; +} + +message GetAccountUsernameRequest { string username = 10; string namespace = 11; } -message GetAccountResponse { +message GetAccountUsernameResponse { Account account = 12; } diff --git a/grpcapi/comasvc_grpc.pb.go b/grpcapi/comasvc_grpc.pb.go index 23c954f..87f337f 100644 --- a/grpcapi/comasvc_grpc.pb.go +++ b/grpcapi/comasvc_grpc.pb.go @@ -25,6 +25,7 @@ type MobilityAccountsClient interface { Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error) UpdateData(ctx context.Context, in *UpdateDataRequest, opts ...grpc.CallOption) (*UpdateDataResponse, error) GetAccount(ctx context.Context, in *GetAccountRequest, opts ...grpc.CallOption) (*GetAccountResponse, error) + GetAccountUsername(ctx context.Context, in *GetAccountUsernameRequest, opts ...grpc.CallOption) (*GetAccountUsernameResponse, error) GetAccounts(ctx context.Context, in *GetAccountsRequest, opts ...grpc.CallOption) (*GetAccountsResponse, error) GetAccountsBatch(ctx context.Context, in *GetAccountsBatchRequest, opts ...grpc.CallOption) (*GetAccountsBatchResponse, error) // Authentication functions @@ -67,6 +68,15 @@ func (c *mobilityAccountsClient) GetAccount(ctx context.Context, in *GetAccountR return out, nil } +func (c *mobilityAccountsClient) GetAccountUsername(ctx context.Context, in *GetAccountUsernameRequest, opts ...grpc.CallOption) (*GetAccountUsernameResponse, error) { + out := new(GetAccountUsernameResponse) + err := c.cc.Invoke(ctx, "/MobilityAccounts/GetAccountUsername", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *mobilityAccountsClient) GetAccounts(ctx context.Context, in *GetAccountsRequest, opts ...grpc.CallOption) (*GetAccountsResponse, error) { out := new(GetAccountsResponse) err := c.cc.Invoke(ctx, "/MobilityAccounts/GetAccounts", in, out, opts...) @@ -110,6 +120,7 @@ type MobilityAccountsServer interface { Register(context.Context, *RegisterRequest) (*RegisterResponse, error) UpdateData(context.Context, *UpdateDataRequest) (*UpdateDataResponse, error) GetAccount(context.Context, *GetAccountRequest) (*GetAccountResponse, error) + GetAccountUsername(context.Context, *GetAccountUsernameRequest) (*GetAccountUsernameResponse, error) GetAccounts(context.Context, *GetAccountsRequest) (*GetAccountsResponse, error) GetAccountsBatch(context.Context, *GetAccountsBatchRequest) (*GetAccountsBatchResponse, error) // Authentication functions @@ -131,6 +142,9 @@ func (UnimplementedMobilityAccountsServer) UpdateData(context.Context, *UpdateDa func (UnimplementedMobilityAccountsServer) GetAccount(context.Context, *GetAccountRequest) (*GetAccountResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetAccount not implemented") } +func (UnimplementedMobilityAccountsServer) GetAccountUsername(context.Context, *GetAccountUsernameRequest) (*GetAccountUsernameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAccountUsername not implemented") +} func (UnimplementedMobilityAccountsServer) GetAccounts(context.Context, *GetAccountsRequest) (*GetAccountsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetAccounts not implemented") } @@ -210,6 +224,24 @@ func _MobilityAccounts_GetAccount_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _MobilityAccounts_GetAccountUsername_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAccountUsernameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MobilityAccountsServer).GetAccountUsername(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/MobilityAccounts/GetAccountUsername", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MobilityAccountsServer).GetAccountUsername(ctx, req.(*GetAccountUsernameRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _MobilityAccounts_GetAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetAccountsRequest) if err := dec(in); err != nil { @@ -301,6 +333,10 @@ var MobilityAccounts_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetAccount", Handler: _MobilityAccounts_GetAccount_Handler, }, + { + MethodName: "GetAccountUsername", + Handler: _MobilityAccounts_GetAccountUsername_Handler, + }, { MethodName: "GetAccounts", Handler: _MobilityAccounts_GetAccounts_Handler, diff --git a/grpcapi/grpcapi.go b/grpcapi/grpcapi.go index c3fe52f..82cecdd 100644 --- a/grpcapi/grpcapi.go +++ b/grpcapi/grpcapi.go @@ -76,6 +76,19 @@ func (s MobilityAccountsServerImpl) GetAccount(ctx context.Context, req *GetAcco } return &GetAccountResponse{Account: response}, nil } +func (s MobilityAccountsServerImpl) GetAccountUsername(ctx context.Context, req *GetAccountUsernameRequest) (*GetAccountUsernameResponse, error) { + account, err := s.handler.GetAccountUsername(req.Username, req.Namespace) + if err != nil { + fmt.Println(err) + return nil, status.Errorf(codes.AlreadyExists, "issue while retrieving account : %v", err) + } + response, err := AccountFromStorageType(account) + if err != nil { + fmt.Println(err) + return nil, status.Errorf(codes.Internal, "issue while retrieving account : %v", err) + } + return &GetAccountUsernameResponse{Account: response}, nil +} func (s MobilityAccountsServerImpl) GetAccounts(ctx context.Context, req *GetAccountsRequest) (*GetAccountsResponse, error) { responses, err := s.handler.GetAccounts(req.Namespaces) if err != nil { diff --git a/handlers/accounts.go b/handlers/accounts.go index be4e8aa..7538570 100644 --- a/handlers/accounts.go +++ b/handlers/accounts.go @@ -120,6 +120,11 @@ func (h MobilityAccountsHandler) GetAccount(id string) (account *storage.Account return } +func (h MobilityAccountsHandler) GetAccountUsername(username string, namespace string) (account *storage.Account, err error) { + account, err = h.storage.DB.LocalAuthentication(namespace, username, "", "") + return +} + func (h MobilityAccountsHandler) GetAccounts(namespaces []string) (accounts []storage.Account, err error) { accounts, err = h.storage.DB.GetAccounts(namespaces) return diff --git a/oidc-provider/templates/parcoursmob/auth.html b/oidc-provider/templates/parcoursmob/auth.html new file mode 100644 index 0000000..4779479 --- /dev/null +++ b/oidc-provider/templates/parcoursmob/auth.html @@ -0,0 +1,73 @@ +{{define "auth"}} + + + PARCOURSMOB - Identification + + + +
+ {{ .csrfField }} + + + + + + +
+
+ +

Connectez vous à PARCOURSMOB

+
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+ + + +
+ +
+ + +
+
+
+
+ + +{{end}} \ No newline at end of file