Able to get user by using name

This commit is contained in:
2024-11-03 01:40:36 +08:00
parent ea150608b4
commit 194d270904
15 changed files with 979 additions and 465 deletions

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc-gen-go-grpc v1.2.0
// - protoc v5.28.2
// source: authenticate.proto
@@ -15,14 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
AuthService_Authenticate_FullMethodName = "/proto.AuthService/Authenticate"
AuthService_EnsurePermGranted_FullMethodName = "/proto.AuthService/EnsurePermGranted"
AuthService_EnsureUserPermGranted_FullMethodName = "/proto.AuthService/EnsureUserPermGranted"
)
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// AuthServiceClient is the client API for AuthService service.
//
@@ -42,9 +36,8 @@ func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient {
}
func (c *authServiceClient) Authenticate(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AuthReply)
err := c.cc.Invoke(ctx, AuthService_Authenticate_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, "/proto.AuthService/Authenticate", in, out, opts...)
if err != nil {
return nil, err
}
@@ -52,9 +45,8 @@ func (c *authServiceClient) Authenticate(ctx context.Context, in *AuthRequest, o
}
func (c *authServiceClient) EnsurePermGranted(ctx context.Context, in *CheckPermRequest, opts ...grpc.CallOption) (*CheckPermResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CheckPermResponse)
err := c.cc.Invoke(ctx, AuthService_EnsurePermGranted_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, "/proto.AuthService/EnsurePermGranted", in, out, opts...)
if err != nil {
return nil, err
}
@@ -62,9 +54,8 @@ func (c *authServiceClient) EnsurePermGranted(ctx context.Context, in *CheckPerm
}
func (c *authServiceClient) EnsureUserPermGranted(ctx context.Context, in *CheckUserPermRequest, opts ...grpc.CallOption) (*CheckUserPermResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CheckUserPermResponse)
err := c.cc.Invoke(ctx, AuthService_EnsureUserPermGranted_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, "/proto.AuthService/EnsureUserPermGranted", in, out, opts...)
if err != nil {
return nil, err
}
@@ -73,7 +64,7 @@ func (c *authServiceClient) EnsureUserPermGranted(ctx context.Context, in *Check
// AuthServiceServer is the server API for AuthService service.
// All implementations must embed UnimplementedAuthServiceServer
// for forward compatibility.
// for forward compatibility
type AuthServiceServer interface {
Authenticate(context.Context, *AuthRequest) (*AuthReply, error)
EnsurePermGranted(context.Context, *CheckPermRequest) (*CheckPermResponse, error)
@@ -81,12 +72,9 @@ type AuthServiceServer interface {
mustEmbedUnimplementedAuthServiceServer()
}
// UnimplementedAuthServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAuthServiceServer struct{}
// UnimplementedAuthServiceServer must be embedded to have forward compatible implementations.
type UnimplementedAuthServiceServer struct {
}
func (UnimplementedAuthServiceServer) Authenticate(context.Context, *AuthRequest) (*AuthReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Authenticate not implemented")
@@ -98,7 +86,6 @@ func (UnimplementedAuthServiceServer) EnsureUserPermGranted(context.Context, *Ch
return nil, status.Errorf(codes.Unimplemented, "method EnsureUserPermGranted not implemented")
}
func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {}
func (UnimplementedAuthServiceServer) testEmbeddedByValue() {}
// UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AuthServiceServer will
@@ -108,13 +95,6 @@ type UnsafeAuthServiceServer interface {
}
func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) {
// If the following call pancis, it indicates UnimplementedAuthServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&AuthService_ServiceDesc, srv)
}
@@ -128,7 +108,7 @@ func _AuthService_Authenticate_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AuthService_Authenticate_FullMethodName,
FullMethod: "/proto.AuthService/Authenticate",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).Authenticate(ctx, req.(*AuthRequest))
@@ -146,7 +126,7 @@ func _AuthService_EnsurePermGranted_Handler(srv interface{}, ctx context.Context
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AuthService_EnsurePermGranted_FullMethodName,
FullMethod: "/proto.AuthService/EnsurePermGranted",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).EnsurePermGranted(ctx, req.(*CheckPermRequest))
@@ -164,7 +144,7 @@ func _AuthService_EnsureUserPermGranted_Handler(srv interface{}, ctx context.Con
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AuthService_EnsureUserPermGranted_FullMethodName,
FullMethod: "/proto.AuthService/EnsureUserPermGranted",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).EnsureUserPermGranted(ctx, req.(*CheckUserPermRequest))