Documentation
¶
Overview ¶
Package plugin defines Funnel's authorization plugin contract and shared HashiCorp go-plugin transport adapters for hosts and plugin implementations. Process discovery and lifecycle management live in internal/pluginmanager.
Index ¶
- Constants
- Variables
- func RegisterAuthorizeServer(s grpc.ServiceRegistrar, srv AuthorizeServer)
- type Authorize
- type AuthorizeClient
- type AuthorizeGRPCPlugin
- type AuthorizePlugin
- type AuthorizeServer
- type Empty
- type GRPCClient
- type GRPCServer
- type Job
- func (*Job) Descriptor() ([]byte, []int)deprecated
- func (x *Job) GetConfig() *config.Config
- func (x *Job) GetHeaders() map[string]*StringList
- func (x *Job) GetParams() map[string]string
- func (x *Job) GetTask() *tes.Task
- func (x *Job) GetType() Type
- func (m *Job) GobDecode(data []byte) error
- func (m *Job) GobEncode() ([]byte, error)
- func (*Job) ProtoMessage()
- func (x *Job) ProtoReflect() protoreflect.Message
- func (x *Job) Reset()
- func (x *Job) String() string
- type JobResponse
- func (*JobResponse) Descriptor() ([]byte, []int)deprecated
- func (x *JobResponse) GetCode() int64
- func (x *JobResponse) GetConfig() *config.Config
- func (x *JobResponse) GetMessage() string
- func (x *JobResponse) GetTask() *tes.Task
- func (x *JobResponse) GetUserId() string
- func (m *JobResponse) GobDecode(data []byte) error
- func (m *JobResponse) GobEncode() ([]byte, error)
- func (*JobResponse) ProtoMessage()
- func (x *JobResponse) ProtoReflect() protoreflect.Message
- func (x *JobResponse) Reset()
- func (x *JobResponse) String() string
- type RPCClient
- type RPCServer
- type StringList
- type Type
- type UnimplementedAuthorizeServer
- type UnsafeAuthorizeServer
Constants ¶
const (
Authorize_PluginAction_FullMethodName = "/proto.Authorize/PluginAction"
)
Variables ¶
var ( Type_name = map[int32]string{ 0: "CREATE", 1: "GET", 2: "CANCEL", } Type_value = map[string]int32{ "CREATE": 0, "GET": 1, "CANCEL": 2, } )
Enum value maps for Type.
var Authorize_ServiceDesc = grpc.ServiceDesc{ ServiceName: "proto.Authorize", HandlerType: (*AuthorizeServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "PluginAction", Handler: _Authorize_PluginAction_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "plugin/plugin.proto", }
Authorize_ServiceDesc is the grpc.ServiceDesc for Authorize service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_plugin_plugin_proto protoreflect.FileDescriptor
var Handshake = hplugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "AUTHORIZE_PLUGIN",
MagicCookieValue: "authorize",
}
Handshake is a common handshake that is shared by plugin and host.
var PluginMap = map[string]hplugin.Plugin{ "authorize_grpc": &AuthorizeGRPCPlugin{}, "authorize": &AuthorizePlugin{}, }
PluginMap is the map of plugins we can dispense.
Functions ¶
func RegisterAuthorizeServer ¶
func RegisterAuthorizeServer(s grpc.ServiceRegistrar, srv AuthorizeServer)
Types ¶
type Authorize ¶
type Authorize interface {
PluginAction(params map[string]string, headers map[string]*StringList, config *config.Config, task *tes.Task, actionType Type) (*JobResponse, error)
}
Authorize is implemented by Funnel authorization plugins.
type AuthorizeClient ¶
type AuthorizeClient interface {
PluginAction(ctx context.Context, in *Job, opts ...grpc.CallOption) (*JobResponse, error)
}
AuthorizeClient is the client API for Authorize 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 NewAuthorizeClient ¶
func NewAuthorizeClient(cc grpc.ClientConnInterface) AuthorizeClient
type AuthorizeGRPCPlugin ¶
type AuthorizeGRPCPlugin struct {
// GRPCPlugin must still implement the Plugin interface
hplugin.Plugin
Impl Authorize
}
AuthorizeGRPCPlugin connects the authorizer to HashiCorp go-plugin over gRPC.
func (*AuthorizeGRPCPlugin) GRPCClient ¶
func (p *AuthorizeGRPCPlugin) GRPCClient(ctx context.Context, broker *hplugin.GRPCBroker, c *grpc.ClientConn) (any, error)
func (*AuthorizeGRPCPlugin) GRPCServer ¶
func (p *AuthorizeGRPCPlugin) GRPCServer(broker *hplugin.GRPCBroker, s *grpc.Server) error
type AuthorizePlugin ¶
type AuthorizePlugin struct {
Impl Authorize
}
AuthorizePlugin connects the authorizer to HashiCorp go-plugin over net/rpc.
type AuthorizeServer ¶
type AuthorizeServer interface {
PluginAction(context.Context, *Job) (*JobResponse, error)
}
AuthorizeServer is the server API for Authorize service. All implementations should embed UnimplementedAuthorizeServer for forward compatibility
type Empty ¶
type Empty struct {
// contains filtered or unexported fields
}
func (*Empty) Descriptor
deprecated
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) ProtoReflect ¶
func (x *Empty) ProtoReflect() protoreflect.Message
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
GRPCClient invokes an authorizer over gRPC.
func (*GRPCClient) PluginAction ¶
func (m *GRPCClient) PluginAction(params map[string]string, headers map[string]*StringList, config *config.Config, task *tes.Task, actionType Type) (*JobResponse, error)
type GRPCServer ¶
type GRPCServer struct {
Impl Authorize
}
func (*GRPCServer) PluginAction ¶
func (m *GRPCServer) PluginAction(ctx context.Context, req *Job) (*JobResponse, error)
type Job ¶
type Job struct {
Headers map[string]*StringList `` /* 141-byte string literal not displayed */
Params map[string]string `` /* 139-byte string literal not displayed */
Config *config.Config `protobuf:"bytes,3,opt,name=config,proto3" json:"config,omitempty"`
Task *tes.Task `protobuf:"bytes,4,opt,name=task,proto3" json:"task,omitempty"`
Type Type `protobuf:"varint,5,opt,name=type,proto3,enum=proto.Type" json:"type,omitempty"`
// contains filtered or unexported fields
}
func (*Job) Descriptor
deprecated
func (*Job) GetHeaders ¶
func (x *Job) GetHeaders() map[string]*StringList
func (*Job) ProtoMessage ¶
func (*Job) ProtoMessage()
func (*Job) ProtoReflect ¶
func (x *Job) ProtoReflect() protoreflect.Message
type JobResponse ¶
type JobResponse struct {
Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
Config *config.Config `protobuf:"bytes,3,opt,name=config,proto3" json:"config,omitempty"`
Task *tes.Task `protobuf:"bytes,4,opt,name=task,proto3" json:"task,omitempty"`
UserId string `protobuf:"bytes,7,opt,name=userId,proto3" json:"userId,omitempty"`
// contains filtered or unexported fields
}
func (*JobResponse) Descriptor
deprecated
func (*JobResponse) Descriptor() ([]byte, []int)
Deprecated: Use JobResponse.ProtoReflect.Descriptor instead.
func (*JobResponse) GetCode ¶
func (x *JobResponse) GetCode() int64
func (*JobResponse) GetConfig ¶
func (x *JobResponse) GetConfig() *config.Config
func (*JobResponse) GetMessage ¶
func (x *JobResponse) GetMessage() string
func (*JobResponse) GetTask ¶
func (x *JobResponse) GetTask() *tes.Task
func (*JobResponse) GetUserId ¶
func (x *JobResponse) GetUserId() string
func (*JobResponse) GobDecode ¶
func (m *JobResponse) GobDecode(data []byte) error
func (*JobResponse) GobEncode ¶
func (m *JobResponse) GobEncode() ([]byte, error)
func (*JobResponse) ProtoMessage ¶
func (*JobResponse) ProtoMessage()
func (*JobResponse) ProtoReflect ¶
func (x *JobResponse) ProtoReflect() protoreflect.Message
func (*JobResponse) Reset ¶
func (x *JobResponse) Reset()
func (*JobResponse) String ¶
func (x *JobResponse) String() string
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient is an implementation of Authorize that talks over RPC.
func (*RPCClient) PluginAction ¶
func (m *RPCClient) PluginAction(params map[string]string, headers map[string]*StringList, config *funnelConfig.Config, task *tes.Task, actionType Type) (*JobResponse, error)
type RPCServer ¶
type RPCServer struct {
Impl Authorize
}
func (*RPCServer) PluginAction ¶
func (m *RPCServer) PluginAction(args *Job, resp *JobResponse) error
type StringList ¶
type StringList struct {
Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
// contains filtered or unexported fields
}
func (*StringList) Descriptor
deprecated
func (*StringList) Descriptor() ([]byte, []int)
Deprecated: Use StringList.ProtoReflect.Descriptor instead.
func (*StringList) GetValues ¶
func (x *StringList) GetValues() []string
func (*StringList) ProtoMessage ¶
func (*StringList) ProtoMessage()
func (*StringList) ProtoReflect ¶
func (x *StringList) ProtoReflect() protoreflect.Message
func (*StringList) Reset ¶
func (x *StringList) Reset()
func (*StringList) String ¶
func (x *StringList) String() string
type Type ¶
type Type int32
func (Type) Descriptor ¶
func (Type) Descriptor() protoreflect.EnumDescriptor
func (Type) EnumDescriptor
deprecated
func (Type) Number ¶
func (x Type) Number() protoreflect.EnumNumber
func (Type) Type ¶
func (Type) Type() protoreflect.EnumType
type UnimplementedAuthorizeServer ¶
type UnimplementedAuthorizeServer struct {
}
UnimplementedAuthorizeServer should be embedded to have forward compatible implementations.
func (UnimplementedAuthorizeServer) PluginAction ¶
func (UnimplementedAuthorizeServer) PluginAction(context.Context, *Job) (*JobResponse, error)
type UnsafeAuthorizeServer ¶
type UnsafeAuthorizeServer interface {
// contains filtered or unexported methods
}
UnsafeAuthorizeServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AuthorizeServer will result in compilation errors.