diff --git a/api/auth/external/auth_api.proto b/api/auth/external/auth_api.proto index dec9296..d2e3782 100644 --- a/api/auth/external/auth_api.proto +++ b/api/auth/external/auth_api.proto @@ -15,6 +15,8 @@ service AuthAPI { rpc SignIn(SignInRequest) returns (SignInResponse); // RefreshSession refreshes session timeout. rpc RefreshSession(RefreshSessionRequest) returns (RefreshSessionResponse); + // ResetPassword initiates user's password reset procedure. + rpc ResetPassword(ResetPasswordRequest) returns (ResetPasswordResponse); } message SignUpRequest { @@ -62,3 +64,14 @@ message RefreshSessionResponse { // Session expiration time. google.protobuf.Timestamp expire_time = 1; } + +message ResetPasswordRequest { + // User email. + string email = 1 [ + (validator.field) = { + string_not_empty: true + } + ]; +} + +message ResetPasswordResponse {} diff --git a/gen/auth/external/auth_api.pb.go b/gen/auth/external/auth_api.pb.go index 7ec0534..37abc94 100644 --- a/gen/auth/external/auth_api.pb.go +++ b/gen/auth/external/auth_api.pb.go @@ -276,6 +276,77 @@ func (m *RefreshSessionResponse) GetExpireTime() *timestamp.Timestamp { return nil } +type ResetPasswordRequest struct { + // User email. + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResetPasswordRequest) Reset() { *m = ResetPasswordRequest{} } +func (m *ResetPasswordRequest) String() string { return proto.CompactTextString(m) } +func (*ResetPasswordRequest) ProtoMessage() {} +func (*ResetPasswordRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7e0315b5819ba925, []int{6} +} + +func (m *ResetPasswordRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResetPasswordRequest.Unmarshal(m, b) +} +func (m *ResetPasswordRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResetPasswordRequest.Marshal(b, m, deterministic) +} +func (m *ResetPasswordRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResetPasswordRequest.Merge(m, src) +} +func (m *ResetPasswordRequest) XXX_Size() int { + return xxx_messageInfo_ResetPasswordRequest.Size(m) +} +func (m *ResetPasswordRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ResetPasswordRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ResetPasswordRequest proto.InternalMessageInfo + +func (m *ResetPasswordRequest) GetEmail() string { + if m != nil { + return m.Email + } + return "" +} + +type ResetPasswordResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResetPasswordResponse) Reset() { *m = ResetPasswordResponse{} } +func (m *ResetPasswordResponse) String() string { return proto.CompactTextString(m) } +func (*ResetPasswordResponse) ProtoMessage() {} +func (*ResetPasswordResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7e0315b5819ba925, []int{7} +} + +func (m *ResetPasswordResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResetPasswordResponse.Unmarshal(m, b) +} +func (m *ResetPasswordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResetPasswordResponse.Marshal(b, m, deterministic) +} +func (m *ResetPasswordResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResetPasswordResponse.Merge(m, src) +} +func (m *ResetPasswordResponse) XXX_Size() int { + return xxx_messageInfo_ResetPasswordResponse.Size(m) +} +func (m *ResetPasswordResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ResetPasswordResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ResetPasswordResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*SignUpRequest)(nil), "percona.platform.auth.external.v1beta1.SignUpRequest") proto.RegisterType((*SignUpResponse)(nil), "percona.platform.auth.external.v1beta1.SignUpResponse") @@ -283,6 +354,8 @@ func init() { proto.RegisterType((*SignInResponse)(nil), "percona.platform.auth.external.v1beta1.SignInResponse") proto.RegisterType((*RefreshSessionRequest)(nil), "percona.platform.auth.external.v1beta1.RefreshSessionRequest") proto.RegisterType((*RefreshSessionResponse)(nil), "percona.platform.auth.external.v1beta1.RefreshSessionResponse") + proto.RegisterType((*ResetPasswordRequest)(nil), "percona.platform.auth.external.v1beta1.ResetPasswordRequest") + proto.RegisterType((*ResetPasswordResponse)(nil), "percona.platform.auth.external.v1beta1.ResetPasswordResponse") } func init() { @@ -290,32 +363,34 @@ func init() { } var fileDescriptor_7e0315b5819ba925 = []byte{ - // 392 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x41, 0x6b, 0xdb, 0x30, - 0x1c, 0xc5, 0x71, 0xc6, 0xb2, 0x45, 0x61, 0xd9, 0x26, 0xd8, 0x16, 0x4c, 0x46, 0x8a, 0x0f, 0xa5, - 0x97, 0xc8, 0x24, 0xa5, 0xb9, 0x94, 0x16, 0x92, 0x9b, 0x6f, 0xad, 0xd3, 0x40, 0xe9, 0x25, 0xc8, - 0xb1, 0x62, 0x8b, 0xda, 0x96, 0x2a, 0xc9, 0x71, 0xbe, 0x44, 0xe9, 0x47, 0x2c, 0xf4, 0x93, 0x14, - 0x5b, 0x76, 0x68, 0x42, 0x0f, 0x71, 0xe9, 0xcd, 0xfa, 0xfb, 0xe9, 0xfd, 0xa4, 0xf7, 0x04, 0x7a, - 0x38, 0x55, 0xa1, 0x4d, 0x36, 0x8a, 0x88, 0x04, 0x47, 0x76, 0xbe, 0x5a, 0x60, 0x4e, 0x11, 0x17, - 0x4c, 0x31, 0x78, 0xcc, 0x89, 0x58, 0xb2, 0x04, 0x23, 0x1e, 0x61, 0xb5, 0x62, 0x22, 0x46, 0xb9, - 0x00, 0x55, 0x72, 0xb4, 0x1e, 0x7a, 0x44, 0xe1, 0xa1, 0x39, 0x0e, 0xa8, 0x0a, 0x53, 0x0f, 0x2d, - 0x59, 0x6c, 0xc7, 0x19, 0x55, 0xf7, 0x2c, 0xb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06, - 0x9a, 0x3a, 0x4e, 0x78, 0x86, 0x0e, 0x7b, 0x2d, 0x68, 0xa7, 0x51, 0x73, 0x5c, 0x77, 0x5b, 0x79, - 0x83, 0x12, 0xec, 0x24, 0xf5, 0xc0, 0xdb, 0x96, 0xeb, 0x81, 0xdf, 0x34, 0xf9, 0x64, 0x80, 0xce, - 0x6e, 0xaa, 0xf0, 0xe2, 0x50, 0xab, 0x77, 0x6b, 0x32, 0x2f, 0x3f, 0xba, 0x5d, 0x9f, 0x68, 0xfa, - 0xfb, 0xee, 0x67, 0x25, 0x2d, 0x95, 0x5e, 0xb3, 0xa8, 0xf0, 0xf4, 0x35, 0x00, 0x00, 0xff, 0xff, - 0x65, 0x9f, 0x8d, 0x1c, 0xe0, 0x03, 0x00, 0x00, + // 431 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x4d, 0x6f, 0xd4, 0x30, + 0x10, 0x55, 0x2a, 0x58, 0xe8, 0x54, 0x2d, 0x60, 0xf1, 0x51, 0x45, 0x45, 0x45, 0x39, 0x20, 0x2e, + 0x75, 0xd4, 0x02, 0xbd, 0x40, 0x91, 0xda, 0x5b, 0x6e, 0x25, 0xa5, 0x12, 0xe2, 0xb2, 0x72, 0x9a, + 0xd9, 0xc4, 0x22, 0x89, 0x8d, 0xed, 0x34, 0xfd, 0x11, 0x48, 0xfc, 0x01, 0xfe, 0x1b, 0x12, 0xbf, + 0x04, 0x25, 0x76, 0x56, 0x64, 0xe1, 0x90, 0xac, 0x7a, 0x8b, 0x27, 0x6f, 0xde, 0x9b, 0x79, 0xf3, + 0x60, 0x8f, 0xd5, 0x26, 0x0f, 0xf1, 0xc6, 0xa0, 0xaa, 0x58, 0x11, 0xb6, 0xaf, 0x39, 0x93, 0x9c, + 0x4a, 0x25, 0x8c, 0x20, 0x2f, 0x25, 0xaa, 0x2b, 0x51, 0x31, 0x2a, 0x0b, 0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 0x49, 0x8c, 0x0b, 0x85, 0x3a, 0xbf, 0xb0, 0x84, 0x6e, 0x91, 0xe0, 0x12, 0x9e, 0xae, 0xfe, + 0x70, 0xe3, 0xac, 0xe8, 0x79, 0x93, 0xf4, 0xde, 0xc0, 0xe3, 0x18, 0x35, 0x9a, 0x73, 0xb7, 0xee, + 0x28, 0xdf, 0xec, 0x94, 0x83, 0x2e, 0x3b, 0xcb, 0xd1, 0xcf, 0x3b, 0x70, 0xef, 0xb4, 0x36, 0xf9, + 0xe9, 0x79, 0x44, 0x1a, 0x98, 0xd9, 0xeb, 0x90, 0xb7, 0x74, 0x5c, 0xf8, 0xe8, 0x20, 0x20, 0xfe, + 0xf1, 0xd4, 0x36, 0x67, 0x88, 0x13, 0x8e, 0xaa, 0x69, 0xc2, 0xcb, 0xd0, 0x4c, 0x13, 0xfe, 0x2b, + 0x18, 0x3f, 0x3c, 0xd8, 0x19, 0x1e, 0x89, 0x9c, 0x8c, 0xa5, 0xfa, 0xef, 0xd5, 0xfd, 0x0f, 0xeb, + 0xb6, 0xbb, 0x89, 0xbe, 0x7b, 0xb0, 0x3d, 0xb8, 0x14, 0x79, 0x3f, 0x9e, 0xf1, 0xdf, 0x58, 0xf8, + 0x27, 0x6b, 0x76, 0xdb, 0x71, 0xce, 0x1e, 0x7d, 0x79, 0xd0, 0x23, 0x1d, 0x30, 0x99, 0x75, 0x01, + 0x7d, 0xfd, 0x27, 0x00, 0x00, 0xff, 0xff, 0xa5, 0x80, 0x60, 0x37, 0xbe, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -336,6 +411,8 @@ type AuthAPIClient interface { SignIn(ctx context.Context, in *SignInRequest, opts ...grpc.CallOption) (*SignInResponse, error) // RefreshSession refreshes session timeout. RefreshSession(ctx context.Context, in *RefreshSessionRequest, opts ...grpc.CallOption) (*RefreshSessionResponse, error) + // ResetPassword initiates user's password reset procedure. + ResetPassword(ctx context.Context, in *ResetPasswordRequest, opts ...grpc.CallOption) (*ResetPasswordResponse, error) } type authAPIClient struct { @@ -373,6 +450,15 @@ func (c *authAPIClient) RefreshSession(ctx context.Context, in *RefreshSessionRe return out, nil } +func (c *authAPIClient) ResetPassword(ctx context.Context, in *ResetPasswordRequest, opts ...grpc.CallOption) (*ResetPasswordResponse, error) { + out := new(ResetPasswordResponse) + err := c.cc.Invoke(ctx, "/percona.platform.auth.external.v1beta1.AuthAPI/ResetPassword", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // AuthAPIServer is the server API for AuthAPI service. type AuthAPIServer interface { // SignUp creates new user with given email and password. @@ -381,6 +467,8 @@ type AuthAPIServer interface { SignIn(context.Context, *SignInRequest) (*SignInResponse, error) // RefreshSession refreshes session timeout. RefreshSession(context.Context, *RefreshSessionRequest) (*RefreshSessionResponse, error) + // ResetPassword initiates user's password reset procedure. + ResetPassword(context.Context, *ResetPasswordRequest) (*ResetPasswordResponse, error) } // UnimplementedAuthAPIServer can be embedded to have forward compatible implementations. @@ -396,6 +484,9 @@ func (*UnimplementedAuthAPIServer) SignIn(ctx context.Context, req *SignInReques func (*UnimplementedAuthAPIServer) RefreshSession(ctx context.Context, req *RefreshSessionRequest) (*RefreshSessionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RefreshSession not implemented") } +func (*UnimplementedAuthAPIServer) ResetPassword(ctx context.Context, req *ResetPasswordRequest) (*ResetPasswordResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResetPassword not implemented") +} func RegisterAuthAPIServer(s *grpc.Server, srv AuthAPIServer) { s.RegisterService(&_AuthAPI_serviceDesc, srv) @@ -455,6 +546,24 @@ func _AuthAPI_RefreshSession_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _AuthAPI_ResetPassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResetPasswordRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthAPIServer).ResetPassword(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/percona.platform.auth.external.v1beta1.AuthAPI/ResetPassword", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthAPIServer).ResetPassword(ctx, req.(*ResetPasswordRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _AuthAPI_serviceDesc = grpc.ServiceDesc{ ServiceName: "percona.platform.auth.external.v1beta1.AuthAPI", HandlerType: (*AuthAPIServer)(nil), @@ -471,6 +580,10 @@ var _AuthAPI_serviceDesc = grpc.ServiceDesc{ MethodName: "RefreshSession", Handler: _AuthAPI_RefreshSession_Handler, }, + { + MethodName: "ResetPassword", + Handler: _AuthAPI_ResetPassword_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "auth/external/auth_api.proto", diff --git a/gen/auth/external/auth_api.validator.pb.go b/gen/auth/external/auth_api.validator.pb.go index ca3121f..0e0466a 100644 --- a/gen/auth/external/auth_api.validator.pb.go +++ b/gen/auth/external/auth_api.validator.pb.go @@ -58,3 +58,12 @@ func (this *RefreshSessionResponse) Validate() error { } return nil } +func (this *ResetPasswordRequest) Validate() error { + if this.Email == "" { + return github_com_mwitkow_go_proto_validators.FieldError("Email", fmt.Errorf(`value '%v' must not be an empty string`, this.Email)) + } + return nil +} +func (this *ResetPasswordResponse) Validate() error { + return nil +}