Documentation ¶
Index ¶
- Variables
- func RegisterOauthServer(s grpc.ServiceRegistrar, srv OauthServer)
- type AuthRequest
- func (*AuthRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AuthRequest) GetPassword() string
- func (x *AuthRequest) GetRole() UserRole
- func (x *AuthRequest) GetUsername() string
- func (*AuthRequest) ProtoMessage()
- func (x *AuthRequest) ProtoReflect() protoreflect.Message
- func (x *AuthRequest) Reset()
- func (x *AuthRequest) String() string
- type AuthResponse
- func (*AuthResponse) Descriptor() ([]byte, []int)deprecated
- func (x *AuthResponse) GetSuccess() bool
- func (x *AuthResponse) GetUser() *User
- func (*AuthResponse) ProtoMessage()
- func (x *AuthResponse) ProtoReflect() protoreflect.Message
- func (x *AuthResponse) Reset()
- func (x *AuthResponse) String() string
- type OauthClient
- type OauthServer
- type UnimplementedOauthServer
- type UnsafeOauthServer
- type User
- type UserRole
Constants ¶
This section is empty.
Variables ¶
var ( UserRole_name = map[int32]string{ 0: "admin", 1: "user", } UserRole_value = map[string]int32{ "admin": 0, "user": 1, } )
Enum value maps for UserRole.
var File_oauth_oauth_proto protoreflect.FileDescriptor
var Oauth_ServiceDesc = grpc.ServiceDesc{ ServiceName: "Oauth", HandlerType: (*OauthServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "AuthUser", Handler: _Oauth_AuthUser_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "oauth/oauth.proto", }
Oauth_ServiceDesc is the grpc.ServiceDesc for Oauth service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterOauthServer ¶ added in v0.4.8
func RegisterOauthServer(s grpc.ServiceRegistrar, srv OauthServer)
Types ¶
type AuthRequest ¶
type AuthRequest 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"` Role UserRole `protobuf:"varint,3,opt,name=role,proto3,enum=UserRole" json:"role,omitempty"` // contains filtered or unexported fields }
func (*AuthRequest) Descriptor
deprecated
func (*AuthRequest) Descriptor() ([]byte, []int)
Deprecated: Use AuthRequest.ProtoReflect.Descriptor instead.
func (*AuthRequest) GetPassword ¶
func (x *AuthRequest) GetPassword() string
func (*AuthRequest) GetRole ¶ added in v0.4.8
func (x *AuthRequest) GetRole() UserRole
func (*AuthRequest) GetUsername ¶
func (x *AuthRequest) GetUsername() string
func (*AuthRequest) ProtoMessage ¶
func (*AuthRequest) ProtoMessage()
func (*AuthRequest) ProtoReflect ¶
func (x *AuthRequest) ProtoReflect() protoreflect.Message
func (*AuthRequest) Reset ¶
func (x *AuthRequest) Reset()
func (*AuthRequest) String ¶
func (x *AuthRequest) String() string
type AuthResponse ¶
type AuthResponse struct { Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` User *User `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` // contains filtered or unexported fields }
The response message containing user authentication info
func (*AuthResponse) Descriptor
deprecated
func (*AuthResponse) Descriptor() ([]byte, []int)
Deprecated: Use AuthResponse.ProtoReflect.Descriptor instead.
func (*AuthResponse) GetSuccess ¶
func (x *AuthResponse) GetSuccess() bool
func (*AuthResponse) GetUser ¶
func (x *AuthResponse) GetUser() *User
func (*AuthResponse) ProtoMessage ¶
func (*AuthResponse) ProtoMessage()
func (*AuthResponse) ProtoReflect ¶
func (x *AuthResponse) ProtoReflect() protoreflect.Message
func (*AuthResponse) Reset ¶
func (x *AuthResponse) Reset()
func (*AuthResponse) String ¶
func (x *AuthResponse) String() string
type OauthClient ¶ added in v0.4.8
type OauthClient interface { // Authenticate user with given credentials AuthUser(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthResponse, error) }
OauthClient is the client API for Oauth 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 NewOauthClient ¶ added in v0.4.8
func NewOauthClient(cc grpc.ClientConnInterface) OauthClient
type OauthServer ¶ added in v0.4.8
type OauthServer interface { // Authenticate user with given credentials AuthUser(context.Context, *AuthRequest) (*AuthResponse, error) // contains filtered or unexported methods }
OauthServer is the server API for Oauth service. All implementations must embed UnimplementedOauthServer for forward compatibility
type UnimplementedOauthServer ¶ added in v0.4.8
type UnimplementedOauthServer struct { }
UnimplementedOauthServer must be embedded to have forward compatible implementations.
func (UnimplementedOauthServer) AuthUser ¶ added in v0.4.8
func (UnimplementedOauthServer) AuthUser(context.Context, *AuthRequest) (*AuthResponse, error)
type UnsafeOauthServer ¶ added in v0.4.8
type UnsafeOauthServer interface {
// contains filtered or unexported methods
}
UnsafeOauthServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to OauthServer will result in compilation errors.
type User ¶
type User struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Role UserRole `protobuf:"varint,2,opt,name=role,proto3,enum=UserRole" json:"role,omitempty"` // contains filtered or unexported fields }
func (*User) Descriptor
deprecated
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message
type UserRole ¶ added in v0.4.8
type UserRole int32
func (UserRole) Descriptor ¶ added in v0.4.8
func (UserRole) Descriptor() protoreflect.EnumDescriptor
func (UserRole) EnumDescriptor
deprecated
added in
v0.4.8
func (UserRole) Number ¶ added in v0.4.8
func (x UserRole) Number() protoreflect.EnumNumber
func (UserRole) Type ¶ added in v0.4.8
func (UserRole) Type() protoreflect.EnumType