oauth

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UserRole_name = map[int32]string{
		0: "admin",
		1: "user",
	}
	UserRole_value = map[string]int32{
		"admin": 0,
		"user":  1,
	}
)

Enum value maps for UserRole.

View Source
var File_oauth_oauth_proto protoreflect.FileDescriptor
View Source
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

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) Descriptor() ([]byte, []int)

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetName

func (x *User) GetName() string

func (*User) GetRole

func (x *User) GetRole() UserRole

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

func (x *User) ProtoReflect() protoreflect.Message

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

type UserRole added in v0.4.8

type UserRole int32
const (
	UserRole_admin UserRole = 0
	UserRole_user  UserRole = 1
)

func (UserRole) Descriptor added in v0.4.8

func (UserRole) Descriptor() protoreflect.EnumDescriptor

func (UserRole) Enum added in v0.4.8

func (x UserRole) Enum() *UserRole

func (UserRole) EnumDescriptor deprecated added in v0.4.8

func (UserRole) EnumDescriptor() ([]byte, []int)

Deprecated: Use UserRole.Descriptor instead.

func (UserRole) Number added in v0.4.8

func (x UserRole) Number() protoreflect.EnumNumber

func (UserRole) String added in v0.4.8

func (x UserRole) String() string

func (UserRole) Type added in v0.4.8

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL