manager

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package manager is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_manager_manager_proto protoreflect.FileDescriptor
View Source
var Manager_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "manager.Manager",
	HandlerType: (*ManagerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Create",
			Handler:    _Manager_Create_Handler,
		},
		{
			MethodName: "RemoveID",
			Handler:    _Manager_RemoveID_Handler,
		},
		{
			MethodName: "RemoveAccess",
			Handler:    _Manager_RemoveAccess_Handler,
		},
		{
			MethodName: "Verify",
			Handler:    _Manager_Verify_Handler,
		},
		{
			MethodName: "Refresh",
			Handler:    _Manager_Refresh_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "manager/manager.proto",
}

Manager_ServiceDesc is the grpc.ServiceDesc for Manager service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterManagerHandler

func RegisterManagerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterManagerHandler registers the http handlers for service Manager to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterManagerHandlerClient

func RegisterManagerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ManagerClient) error

RegisterManagerHandlerClient registers the http handlers for service Manager to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ManagerClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ManagerClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ManagerClient" to call the correct interceptors.

func RegisterManagerHandlerFromEndpoint

func RegisterManagerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterManagerHandlerFromEndpoint is same as RegisterManagerHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterManagerHandlerServer

func RegisterManagerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ManagerServer) error

RegisterManagerHandlerServer registers the http handlers for service Manager to "mux". UnaryRPC :call ManagerServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterManagerHandlerFromEndpoint instead.

func RegisterManagerServer

func RegisterManagerServer(s grpc.ServiceRegistrar, srv ManagerServer)

Types

type CreateRequest

type CreateRequest struct {

	// create authorization token associated with id, usually the client platform and user id.
	//
	// like this :
	// * web-1
	// * android-1
	// * ios-1
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Initialization key-value pair associated with token
	Pairs []*Pair `protobuf:"bytes,2,rep,name=pairs,proto3" json:"pairs,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRequest) Descriptor deprecated

func (*CreateRequest) Descriptor() ([]byte, []int)

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetId

func (x *CreateRequest) GetId() string

func (*CreateRequest) GetPairs

func (x *CreateRequest) GetPairs() []*Pair

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

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

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

type CreateResponse

type CreateResponse struct {

	// provider id
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// access token
	Access string `protobuf:"bytes,2,opt,name=access,proto3" json:"access,omitempty"`
	// refresh token
	Refresh string `protobuf:"bytes,3,opt,name=refresh,proto3" json:"refresh,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateResponse) Descriptor deprecated

func (*CreateResponse) Descriptor() ([]byte, []int)

Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.

func (*CreateResponse) GetAccess

func (x *CreateResponse) GetAccess() string

func (*CreateResponse) GetId

func (x *CreateResponse) GetId() string

func (*CreateResponse) GetRefresh

func (x *CreateResponse) GetRefresh() string

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) ProtoReflect

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

func (*CreateResponse) Reset

func (x *CreateResponse) Reset()

func (*CreateResponse) String

func (x *CreateResponse) String() string

type ManagerClient

type ManagerClient interface {
	// Create an authorization token
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
	// Remove token by id
	RemoveID(ctx context.Context, in *RemoveIDRequest, opts ...grpc.CallOption) (*RemoveIDResponse, error)
	// Remove token by access token
	RemoveAccess(ctx context.Context, in *RemoveAccessRequest, opts ...grpc.CallOption) (*RemoveAccessResponse, error)
	// Verify access token signature
	Verify(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error)
	// Refresh access and refresh token
	Refresh(ctx context.Context, in *RefreshRequest, opts ...grpc.CallOption) (*RefreshResponse, error)
}

ManagerClient is the client API for Manager 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 NewManagerClient

func NewManagerClient(cc grpc.ClientConnInterface) ManagerClient

type ManagerServer

type ManagerServer interface {
	// Create an authorization token
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
	// Remove token by id
	RemoveID(context.Context, *RemoveIDRequest) (*RemoveIDResponse, error)
	// Remove token by access token
	RemoveAccess(context.Context, *RemoveAccessRequest) (*RemoveAccessResponse, error)
	// Verify access token signature
	Verify(context.Context, *VerifyRequest) (*VerifyResponse, error)
	// Refresh access and refresh token
	Refresh(context.Context, *RefreshRequest) (*RefreshResponse, error)
	// contains filtered or unexported methods
}

ManagerServer is the server API for Manager service. All implementations must embed UnimplementedManagerServer for forward compatibility

type Pair

type Pair struct {

	// key name
	// __private_provider_redis is reserved on redis backend
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// serialized binary data, it is recommended to use json serialization
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Pair) Descriptor deprecated

func (*Pair) Descriptor() ([]byte, []int)

Deprecated: Use Pair.ProtoReflect.Descriptor instead.

func (*Pair) GetKey

func (x *Pair) GetKey() string

func (*Pair) GetValue

func (x *Pair) GetValue() []byte

func (*Pair) ProtoMessage

func (*Pair) ProtoMessage()

func (*Pair) ProtoReflect

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

func (*Pair) Reset

func (x *Pair) Reset()

func (*Pair) String

func (x *Pair) String() string

type RefreshRequest

type RefreshRequest struct {

	// old access token
	Access string `protobuf:"bytes,1,opt,name=access,proto3" json:"access,omitempty"`
	// old refresh token
	Refresh string `protobuf:"bytes,2,opt,name=refresh,proto3" json:"refresh,omitempty"`
	// contains filtered or unexported fields
}

func (*RefreshRequest) Descriptor deprecated

func (*RefreshRequest) Descriptor() ([]byte, []int)

Deprecated: Use RefreshRequest.ProtoReflect.Descriptor instead.

func (*RefreshRequest) GetAccess

func (x *RefreshRequest) GetAccess() string

func (*RefreshRequest) GetRefresh

func (x *RefreshRequest) GetRefresh() string

func (*RefreshRequest) ProtoMessage

func (*RefreshRequest) ProtoMessage()

func (*RefreshRequest) ProtoReflect

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

func (*RefreshRequest) Reset

func (x *RefreshRequest) Reset()

func (*RefreshRequest) String

func (x *RefreshRequest) String() string

type RefreshResponse

type RefreshResponse struct {

	// new access token
	Access string `protobuf:"bytes,1,opt,name=access,proto3" json:"access,omitempty"`
	// new refresh token
	Refresh string `protobuf:"bytes,2,opt,name=refresh,proto3" json:"refresh,omitempty"`
	// contains filtered or unexported fields
}

func (*RefreshResponse) Descriptor deprecated

func (*RefreshResponse) Descriptor() ([]byte, []int)

Deprecated: Use RefreshResponse.ProtoReflect.Descriptor instead.

func (*RefreshResponse) GetAccess

func (x *RefreshResponse) GetAccess() string

func (*RefreshResponse) GetRefresh

func (x *RefreshResponse) GetRefresh() string

func (*RefreshResponse) ProtoMessage

func (*RefreshResponse) ProtoMessage()

func (*RefreshResponse) ProtoReflect

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

func (*RefreshResponse) Reset

func (x *RefreshResponse) Reset()

func (*RefreshResponse) String

func (x *RefreshResponse) String() string

type RemoveAccessRequest

type RemoveAccessRequest struct {

	// access token
	Access string `protobuf:"bytes,1,opt,name=access,proto3" json:"access,omitempty"`
	// contains filtered or unexported fields
}

func (*RemoveAccessRequest) Descriptor deprecated

func (*RemoveAccessRequest) Descriptor() ([]byte, []int)

Deprecated: Use RemoveAccessRequest.ProtoReflect.Descriptor instead.

func (*RemoveAccessRequest) GetAccess

func (x *RemoveAccessRequest) GetAccess() string

func (*RemoveAccessRequest) ProtoMessage

func (*RemoveAccessRequest) ProtoMessage()

func (*RemoveAccessRequest) ProtoReflect

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

func (*RemoveAccessRequest) Reset

func (x *RemoveAccessRequest) Reset()

func (*RemoveAccessRequest) String

func (x *RemoveAccessRequest) String() string

type RemoveAccessResponse

type RemoveAccessResponse struct {
	// contains filtered or unexported fields
}

func (*RemoveAccessResponse) Descriptor deprecated

func (*RemoveAccessResponse) Descriptor() ([]byte, []int)

Deprecated: Use RemoveAccessResponse.ProtoReflect.Descriptor instead.

func (*RemoveAccessResponse) ProtoMessage

func (*RemoveAccessResponse) ProtoMessage()

func (*RemoveAccessResponse) ProtoReflect

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

func (*RemoveAccessResponse) Reset

func (x *RemoveAccessResponse) Reset()

func (*RemoveAccessResponse) String

func (x *RemoveAccessResponse) String() string

type RemoveIDRequest

type RemoveIDRequest struct {

	// CreateRequest.id
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*RemoveIDRequest) Descriptor deprecated

func (*RemoveIDRequest) Descriptor() ([]byte, []int)

Deprecated: Use RemoveIDRequest.ProtoReflect.Descriptor instead.

func (*RemoveIDRequest) GetId

func (x *RemoveIDRequest) GetId() string

func (*RemoveIDRequest) ProtoMessage

func (*RemoveIDRequest) ProtoMessage()

func (*RemoveIDRequest) ProtoReflect

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

func (*RemoveIDRequest) Reset

func (x *RemoveIDRequest) Reset()

func (*RemoveIDRequest) String

func (x *RemoveIDRequest) String() string

type RemoveIDResponse

type RemoveIDResponse struct {
	// contains filtered or unexported fields
}

func (*RemoveIDResponse) Descriptor deprecated

func (*RemoveIDResponse) Descriptor() ([]byte, []int)

Deprecated: Use RemoveIDResponse.ProtoReflect.Descriptor instead.

func (*RemoveIDResponse) ProtoMessage

func (*RemoveIDResponse) ProtoMessage()

func (*RemoveIDResponse) ProtoReflect

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

func (*RemoveIDResponse) Reset

func (x *RemoveIDResponse) Reset()

func (*RemoveIDResponse) String

func (x *RemoveIDResponse) String() string

type UnimplementedManagerServer

type UnimplementedManagerServer struct {
}

UnimplementedManagerServer must be embedded to have forward compatible implementations.

func (UnimplementedManagerServer) Create

func (UnimplementedManagerServer) Refresh

func (UnimplementedManagerServer) RemoveAccess

func (UnimplementedManagerServer) RemoveID

func (UnimplementedManagerServer) Verify

type UnsafeManagerServer

type UnsafeManagerServer interface {
	// contains filtered or unexported methods
}

UnsafeManagerServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ManagerServer will result in compilation errors.

type VerifyRequest

type VerifyRequest struct {

	// access token
	Access string `protobuf:"bytes,1,opt,name=access,proto3" json:"access,omitempty"`
	// contains filtered or unexported fields
}

func (*VerifyRequest) Descriptor deprecated

func (*VerifyRequest) Descriptor() ([]byte, []int)

Deprecated: Use VerifyRequest.ProtoReflect.Descriptor instead.

func (*VerifyRequest) GetAccess

func (x *VerifyRequest) GetAccess() string

func (*VerifyRequest) ProtoMessage

func (*VerifyRequest) ProtoMessage()

func (*VerifyRequest) ProtoReflect

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

func (*VerifyRequest) Reset

func (x *VerifyRequest) Reset()

func (*VerifyRequest) String

func (x *VerifyRequest) String() string

type VerifyResponse

type VerifyResponse struct {

	// provider id
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*VerifyResponse) Descriptor deprecated

func (*VerifyResponse) Descriptor() ([]byte, []int)

Deprecated: Use VerifyResponse.ProtoReflect.Descriptor instead.

func (*VerifyResponse) GetId

func (x *VerifyResponse) GetId() string

func (*VerifyResponse) ProtoMessage

func (*VerifyResponse) ProtoMessage()

func (*VerifyResponse) ProtoReflect

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

func (*VerifyResponse) Reset

func (x *VerifyResponse) Reset()

func (*VerifyResponse) String

func (x *VerifyResponse) String() string

Jump to

Keyboard shortcuts

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