diff --git a/auth/auth.pb.go b/auth/auth.pb.go index 407f4f9..6396df7 100644 --- a/auth/auth.pb.go +++ b/auth/auth.pb.go @@ -67,20 +67,18 @@ func (x *IdMessage) GetSessionID() string { return "" } -type SessionResponse struct { +type SessionUserResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SessionID string `protobuf:"bytes,1,opt,name=SessionID,proto3" json:"SessionID,omitempty"` - UserID uint64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` - Username string `protobuf:"bytes,3,opt,name=Username,proto3" json:"Username,omitempty"` - Created uint64 `protobuf:"varint,4,opt,name=Created,proto3" json:"Created,omitempty"` - Expires uint64 `protobuf:"varint,5,opt,name=Expires,proto3" json:"Expires,omitempty"` + UserID uint64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` + Username string `protobuf:"bytes,2,opt,name=Username,proto3" json:"Username,omitempty"` + AvatarURL string `protobuf:"bytes,3,opt,name=AvatarURL,proto3" json:"AvatarURL,omitempty"` } -func (x *SessionResponse) Reset() { - *x = SessionResponse{} +func (x *SessionUserResponse) Reset() { + *x = SessionUserResponse{} if protoimpl.UnsafeEnabled { mi := &file_auth_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -88,13 +86,13 @@ func (x *SessionResponse) Reset() { } } -func (x *SessionResponse) String() string { +func (x *SessionUserResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SessionResponse) ProtoMessage() {} +func (*SessionUserResponse) ProtoMessage() {} -func (x *SessionResponse) ProtoReflect() protoreflect.Message { +func (x *SessionUserResponse) ProtoReflect() protoreflect.Message { mi := &file_auth_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -106,44 +104,30 @@ func (x *SessionResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SessionResponse.ProtoReflect.Descriptor instead. -func (*SessionResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use SessionUserResponse.ProtoReflect.Descriptor instead. +func (*SessionUserResponse) Descriptor() ([]byte, []int) { return file_auth_proto_rawDescGZIP(), []int{1} } -func (x *SessionResponse) GetSessionID() string { - if x != nil { - return x.SessionID - } - return "" -} - -func (x *SessionResponse) GetUserID() uint64 { +func (x *SessionUserResponse) GetUserID() uint64 { if x != nil { return x.UserID } return 0 } -func (x *SessionResponse) GetUsername() string { +func (x *SessionUserResponse) GetUsername() string { if x != nil { return x.Username } return "" } -func (x *SessionResponse) GetCreated() uint64 { +func (x *SessionUserResponse) GetAvatarURL() string { if x != nil { - return x.Created + return x.AvatarURL } - return 0 -} - -func (x *SessionResponse) GetExpires() uint64 { - if x != nil { - return x.Expires - } - return 0 + return "" } type RoleReponse struct { @@ -246,36 +230,34 @@ var file_auth_proto_rawDesc = []byte{ 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x61, 0x75, 0x74, 0x68, 0x22, 0x29, 0x0a, 0x09, 0x49, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x22, 0x97, 0x01, - 0x0a, 0x0f, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, - 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, - 0x07, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, - 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x22, 0x21, 0x0a, 0x0b, 0x52, 0x6f, 0x6c, 0x65, 0x52, - 0x65, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x28, 0x0a, 0x10, 0x56, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x56, - 0x61, 0x6c, 0x69, 0x64, 0x32, 0xb3, 0x01, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x49, 0x64, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x1a, 0x15, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0c, 0x47, 0x65, - 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x0f, 0x2e, 0x61, 0x75, 0x74, - 0x68, 0x2e, 0x49, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x11, 0x2e, 0x61, 0x75, - 0x74, 0x68, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, - 0x0a, 0x0f, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x0f, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x49, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x1a, 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, - 0x74, 0x2e, 0x69, 0x74, 0x7a, 0x61, 0x6e, 0x61, 0x2e, 0x6d, 0x65, 0x2f, 0x73, 0x74, 0x72, 0x61, - 0x66, 0x65, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x2d, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x61, - 0x75, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x28, 0x09, 0x52, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x22, 0x67, 0x0a, + 0x13, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, + 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x76, 0x61, 0x74, + 0x61, 0x72, 0x55, 0x52, 0x4c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x41, 0x76, 0x61, + 0x74, 0x61, 0x72, 0x55, 0x52, 0x4c, 0x22, 0x21, 0x0a, 0x0b, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x28, 0x0a, 0x10, 0x56, 0x61, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x32, 0xbb, 0x01, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x3c, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0f, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x49, 0x64, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x19, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x32, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x6f, 0x6c, + 0x65, 0x12, 0x0f, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x49, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x1a, 0x11, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x0f, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, + 0x49, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, + 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x2e, 0x69, 0x74, 0x7a, 0x61, 0x6e, 0x61, 0x2e, + 0x6d, 0x65, 0x2f, 0x73, 0x74, 0x72, 0x61, 0x66, 0x65, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x6f, + 0x2d, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -292,16 +274,16 @@ func file_auth_proto_rawDescGZIP() []byte { var file_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_auth_proto_goTypes = []interface{}{ - (*IdMessage)(nil), // 0: auth.IdMessage - (*SessionResponse)(nil), // 1: auth.SessionResponse - (*RoleReponse)(nil), // 2: auth.RoleReponse - (*ValidateResponse)(nil), // 3: auth.ValidateResponse + (*IdMessage)(nil), // 0: auth.IdMessage + (*SessionUserResponse)(nil), // 1: auth.SessionUserResponse + (*RoleReponse)(nil), // 2: auth.RoleReponse + (*ValidateResponse)(nil), // 3: auth.ValidateResponse } var file_auth_proto_depIdxs = []int32{ - 0, // 0: auth.AuthService.GetSession:input_type -> auth.IdMessage + 0, // 0: auth.AuthService.GetSessionUser:input_type -> auth.IdMessage 0, // 1: auth.AuthService.GetGroupRole:input_type -> auth.IdMessage 0, // 2: auth.AuthService.ValidateSession:input_type -> auth.IdMessage - 1, // 3: auth.AuthService.GetSession:output_type -> auth.SessionResponse + 1, // 3: auth.AuthService.GetSessionUser:output_type -> auth.SessionUserResponse 2, // 4: auth.AuthService.GetGroupRole:output_type -> auth.RoleReponse 3, // 5: auth.AuthService.ValidateSession:output_type -> auth.ValidateResponse 3, // [3:6] is the sub-list for method output_type @@ -330,7 +312,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SessionResponse); i { + switch v := v.(*SessionUserResponse); i { case 0: return &v.state case 1: diff --git a/auth/auth_grpc.pb.go b/auth/auth_grpc.pb.go index 77a82c0..5b53266 100644 --- a/auth/auth_grpc.pb.go +++ b/auth/auth_grpc.pb.go @@ -22,7 +22,7 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type AuthServiceClient interface { - GetSession(ctx context.Context, in *IdMessage, opts ...grpc.CallOption) (*SessionResponse, error) + GetSessionUser(ctx context.Context, in *IdMessage, opts ...grpc.CallOption) (*SessionUserResponse, error) GetGroupRole(ctx context.Context, in *IdMessage, opts ...grpc.CallOption) (*RoleReponse, error) ValidateSession(ctx context.Context, in *IdMessage, opts ...grpc.CallOption) (*ValidateResponse, error) } @@ -35,9 +35,9 @@ func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient { return &authServiceClient{cc} } -func (c *authServiceClient) GetSession(ctx context.Context, in *IdMessage, opts ...grpc.CallOption) (*SessionResponse, error) { - out := new(SessionResponse) - err := c.cc.Invoke(ctx, "/auth.AuthService/GetSession", in, out, opts...) +func (c *authServiceClient) GetSessionUser(ctx context.Context, in *IdMessage, opts ...grpc.CallOption) (*SessionUserResponse, error) { + out := new(SessionUserResponse) + err := c.cc.Invoke(ctx, "/auth.AuthService/GetSessionUser", in, out, opts...) if err != nil { return nil, err } @@ -66,7 +66,7 @@ func (c *authServiceClient) ValidateSession(ctx context.Context, in *IdMessage, // All implementations must embed UnimplementedAuthServiceServer // for forward compatibility type AuthServiceServer interface { - GetSession(context.Context, *IdMessage) (*SessionResponse, error) + GetSessionUser(context.Context, *IdMessage) (*SessionUserResponse, error) GetGroupRole(context.Context, *IdMessage) (*RoleReponse, error) ValidateSession(context.Context, *IdMessage) (*ValidateResponse, error) mustEmbedUnimplementedAuthServiceServer() @@ -76,8 +76,8 @@ type AuthServiceServer interface { type UnimplementedAuthServiceServer struct { } -func (UnimplementedAuthServiceServer) GetSession(context.Context, *IdMessage) (*SessionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetSession not implemented") +func (UnimplementedAuthServiceServer) GetSessionUser(context.Context, *IdMessage) (*SessionUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSessionUser not implemented") } func (UnimplementedAuthServiceServer) GetGroupRole(context.Context, *IdMessage) (*RoleReponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetGroupRole not implemented") @@ -98,20 +98,20 @@ func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) { s.RegisterService(&AuthService_ServiceDesc, srv) } -func _AuthService_GetSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _AuthService_GetSessionUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(IdMessage) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(AuthServiceServer).GetSession(ctx, in) + return srv.(AuthServiceServer).GetSessionUser(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/auth.AuthService/GetSession", + FullMethod: "/auth.AuthService/GetSessionUser", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServiceServer).GetSession(ctx, req.(*IdMessage)) + return srv.(AuthServiceServer).GetSessionUser(ctx, req.(*IdMessage)) } return interceptor(ctx, in, info, handler) } @@ -160,8 +160,8 @@ var AuthService_ServiceDesc = grpc.ServiceDesc{ HandlerType: (*AuthServiceServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "GetSession", - Handler: _AuthService_GetSession_Handler, + MethodName: "GetSessionUser", + Handler: _AuthService_GetSessionUser_Handler, }, { MethodName: "GetGroupRole",