Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer)
- func RegisterServer(s grpc.ServiceRegistrar, token Token)
- type AuthServiceClient
- type AuthServiceServer
- type LoginReply
- type LoginUser
- func (*LoginUser) Descriptor() ([]byte, []int)deprecated
- func (x *LoginUser) GetPassword() string
- func (x *LoginUser) GetTimestamp() int64
- func (x *LoginUser) GetUsername() string
- func (*LoginUser) ProtoMessage()
- func (x *LoginUser) ProtoReflect() protoreflect.Message
- func (x *LoginUser) Reset()
- func (x *LoginUser) String() string
- type Token
- type TokenUser
- func (*TokenUser) Descriptor() ([]byte, []int)deprecated
- func (x *TokenUser) GetExpires() int64
- func (x *TokenUser) GetUserId() int32
- func (x *TokenUser) GetUsername() string
- func (*TokenUser) ProtoMessage()
- func (x *TokenUser) ProtoReflect() protoreflect.Message
- func (x *TokenUser) Reset()
- func (x *TokenUser) String() string
- type UnimplementedAuthServiceServer
- type UnsafeAuthServiceServer
Constants ¶
const (
AuthService_Login_FullMethodName = "/auth.AuthService/Login"
)
Variables ¶
var AuthService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "auth.AuthService", HandlerType: (*AuthServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Login", Handler: _AuthService_Login_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/proto/auth.proto", }
AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_api_proto_auth_proto protoreflect.FileDescriptor
Functions ¶
func RegisterAuthServiceServer ¶
func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer)
func RegisterServer ¶
func RegisterServer(s grpc.ServiceRegistrar, token Token)
RegisterServer register the auth server
Types ¶
type AuthServiceClient ¶
type AuthServiceClient interface { // Login login to the api server and return the access token Login(ctx context.Context, in *LoginUser, opts ...grpc.CallOption) (*LoginReply, error) }
AuthServiceClient is the client API for AuthService service.
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.
func NewAuthServiceClient ¶
func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient
type AuthServiceServer ¶
type AuthServiceServer interface { // Login login to the api server and return the access token Login(context.Context, *LoginUser) (*LoginReply, error) // contains filtered or unexported methods }
AuthServiceServer is the server API for AuthService service. All implementations must embed UnimplementedAuthServiceServer for forward compatibility
type LoginReply ¶
type LoginReply struct { Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` // contains filtered or unexported fields }
func (*LoginReply) Descriptor
deprecated
func (*LoginReply) Descriptor() ([]byte, []int)
Deprecated: Use LoginReply.ProtoReflect.Descriptor instead.
func (*LoginReply) GetToken ¶
func (x *LoginReply) GetToken() string
func (*LoginReply) ProtoMessage ¶
func (*LoginReply) ProtoMessage()
func (*LoginReply) ProtoReflect ¶
func (x *LoginReply) ProtoReflect() protoreflect.Message
func (*LoginReply) Reset ¶
func (x *LoginReply) Reset()
func (*LoginReply) String ¶
func (x *LoginReply) String() string
type LoginUser ¶
type LoginUser struct { Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // contains filtered or unexported fields }
func (*LoginUser) Descriptor
deprecated
func (*LoginUser) GetPassword ¶
func (*LoginUser) GetTimestamp ¶
func (*LoginUser) GetUsername ¶
func (*LoginUser) ProtoMessage ¶
func (*LoginUser) ProtoMessage()
func (*LoginUser) ProtoReflect ¶
func (x *LoginUser) ProtoReflect() protoreflect.Message
type Token ¶
type Token interface { // GenerateToken generate a new token by user info GenerateToken(in *LoginUser) (token string, err error) // IsLogin resolve the token in the context.Context IsLogin(ctx context.Context) (user *auth.User, err error) }
Token an authentication and token component
type TokenUser ¶
type TokenUser struct { UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` Expires int64 `protobuf:"varint,3,opt,name=expires,proto3" json:"expires,omitempty"` // contains filtered or unexported fields }
func (*TokenUser) Descriptor
deprecated
func (*TokenUser) GetExpires ¶
func (*TokenUser) GetUsername ¶
func (*TokenUser) ProtoMessage ¶
func (*TokenUser) ProtoMessage()
func (*TokenUser) ProtoReflect ¶
func (x *TokenUser) ProtoReflect() protoreflect.Message
type UnimplementedAuthServiceServer ¶
type UnimplementedAuthServiceServer struct { }
UnimplementedAuthServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedAuthServiceServer) Login ¶
func (UnimplementedAuthServiceServer) Login(context.Context, *LoginUser) (*LoginReply, error)
type UnsafeAuthServiceServer ¶
type UnsafeAuthServiceServer interface {
// contains filtered or unexported methods
}
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 result in compilation errors.