access

package
v0.0.0-...-d58afed Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package access is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Access_Evaluation_FullMethodName  = "/authzen.access.v1.Access/Evaluation"
	Access_Evaluations_FullMethodName = "/authzen.access.v1.Access/Evaluations"
)

Variables

View Source
var Access_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "authzen.access.v1.Access",
	HandlerType: (*AccessServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Evaluation",
			Handler:    _Access_Evaluation_Handler,
		},
		{
			MethodName: "Evaluations",
			Handler:    _Access_Evaluations_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "access/v1/access.proto",
}

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

View Source
var File_access_v1_access_proto protoreflect.FileDescriptor

Functions

func RegisterAccessHandler

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

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

func RegisterAccessHandlerClient

func RegisterAccessHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccessClient) error

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

func RegisterAccessHandlerFromEndpoint

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

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

func RegisterAccessHandlerServer

func RegisterAccessHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccessServer) error

RegisterAccessHandlerServer registers the http handlers for service Access to "mux". UnaryRPC :call AccessServer 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 RegisterAccessHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterAccessServer

func RegisterAccessServer(s grpc.ServiceRegistrar, srv AccessServer)

Types

type AccessClient

type AccessClient interface {
	// evaluation
	Evaluation(ctx context.Context, in *EvaluationRequest, opts ...grpc.CallOption) (*EvaluationResponse, error)
	// evaluations
	Evaluations(ctx context.Context, in *EvaluationsRequest, opts ...grpc.CallOption) (*EvaluationsResponse, error)
}

AccessClient is the client API for Access 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 NewAccessClient

func NewAccessClient(cc grpc.ClientConnInterface) AccessClient

type AccessServer

type AccessServer interface {
	// evaluation
	Evaluation(context.Context, *EvaluationRequest) (*EvaluationResponse, error)
	// evaluations
	Evaluations(context.Context, *EvaluationsRequest) (*EvaluationsResponse, error)
}

AccessServer is the server API for Access service. All implementations should embed UnimplementedAccessServer for forward compatibility.

type Action

type Action struct {
	Name       string           `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Properties *structpb.Struct `protobuf:"bytes,2,opt,name=properties,proto3" json:"properties,omitempty"`
	// contains filtered or unexported fields
}

func (*Action) Descriptor deprecated

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

Deprecated: Use Action.ProtoReflect.Descriptor instead.

func (*Action) GetName

func (x *Action) GetName() string

func (*Action) GetProperties

func (x *Action) GetProperties() *structpb.Struct

func (*Action) ProtoMessage

func (*Action) ProtoMessage()

func (*Action) ProtoReflect

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

func (*Action) Reset

func (x *Action) Reset()

func (*Action) String

func (x *Action) String() string

type EvaluationRequest

type EvaluationRequest struct {
	Subject  *Subject         `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"`
	Action   *Action          `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"`
	Resource *Resource        `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"`
	Context  *structpb.Struct `protobuf:"bytes,4,opt,name=context,proto3" json:"context,omitempty"`
	// contains filtered or unexported fields
}

func (*EvaluationRequest) Descriptor deprecated

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

Deprecated: Use EvaluationRequest.ProtoReflect.Descriptor instead.

func (*EvaluationRequest) GetAction

func (x *EvaluationRequest) GetAction() *Action

func (*EvaluationRequest) GetContext

func (x *EvaluationRequest) GetContext() *structpb.Struct

func (*EvaluationRequest) GetResource

func (x *EvaluationRequest) GetResource() *Resource

func (*EvaluationRequest) GetSubject

func (x *EvaluationRequest) GetSubject() *Subject

func (*EvaluationRequest) ProtoMessage

func (*EvaluationRequest) ProtoMessage()

func (*EvaluationRequest) ProtoReflect

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

func (*EvaluationRequest) Reset

func (x *EvaluationRequest) Reset()

func (*EvaluationRequest) String

func (x *EvaluationRequest) String() string

type EvaluationResponse

type EvaluationResponse struct {
	Decision bool             `protobuf:"varint,1,opt,name=decision,proto3" json:"decision,omitempty"`
	Context  *structpb.Struct `protobuf:"bytes,2,opt,name=context,proto3" json:"context,omitempty"`
	// contains filtered or unexported fields
}

func (*EvaluationResponse) Descriptor deprecated

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

Deprecated: Use EvaluationResponse.ProtoReflect.Descriptor instead.

func (*EvaluationResponse) GetContext

func (x *EvaluationResponse) GetContext() *structpb.Struct

func (*EvaluationResponse) GetDecision

func (x *EvaluationResponse) GetDecision() bool

func (*EvaluationResponse) ProtoMessage

func (*EvaluationResponse) ProtoMessage()

func (*EvaluationResponse) ProtoReflect

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

func (*EvaluationResponse) Reset

func (x *EvaluationResponse) Reset()

func (*EvaluationResponse) String

func (x *EvaluationResponse) String() string

type EvaluationsRequest

type EvaluationsRequest struct {
	Subject     *Subject             `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"`
	Action      *Action              `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"`
	Resource    *Resource            `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"`
	Context     *structpb.Struct     `protobuf:"bytes,4,opt,name=context,proto3" json:"context,omitempty"`
	Evaluations []*EvaluationRequest `protobuf:"bytes,5,rep,name=evaluations,proto3" json:"evaluations,omitempty"`
	Options     *structpb.Struct     `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"`
	// contains filtered or unexported fields
}

func (*EvaluationsRequest) Descriptor deprecated

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

Deprecated: Use EvaluationsRequest.ProtoReflect.Descriptor instead.

func (*EvaluationsRequest) GetAction

func (x *EvaluationsRequest) GetAction() *Action

func (*EvaluationsRequest) GetContext

func (x *EvaluationsRequest) GetContext() *structpb.Struct

func (*EvaluationsRequest) GetEvaluations

func (x *EvaluationsRequest) GetEvaluations() []*EvaluationRequest

func (*EvaluationsRequest) GetOptions

func (x *EvaluationsRequest) GetOptions() *structpb.Struct

func (*EvaluationsRequest) GetResource

func (x *EvaluationsRequest) GetResource() *Resource

func (*EvaluationsRequest) GetSubject

func (x *EvaluationsRequest) GetSubject() *Subject

func (*EvaluationsRequest) ProtoMessage

func (*EvaluationsRequest) ProtoMessage()

func (*EvaluationsRequest) ProtoReflect

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

func (*EvaluationsRequest) Reset

func (x *EvaluationsRequest) Reset()

func (*EvaluationsRequest) String

func (x *EvaluationsRequest) String() string

type EvaluationsResponse

type EvaluationsResponse struct {
	Decisions []*EvaluationResponse `protobuf:"bytes,1,rep,name=decisions,proto3" json:"decisions,omitempty"`
	// contains filtered or unexported fields
}

func (*EvaluationsResponse) Descriptor deprecated

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

Deprecated: Use EvaluationsResponse.ProtoReflect.Descriptor instead.

func (*EvaluationsResponse) GetDecisions

func (x *EvaluationsResponse) GetDecisions() []*EvaluationResponse

func (*EvaluationsResponse) ProtoMessage

func (*EvaluationsResponse) ProtoMessage()

func (*EvaluationsResponse) ProtoReflect

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

func (*EvaluationsResponse) Reset

func (x *EvaluationsResponse) Reset()

func (*EvaluationsResponse) String

func (x *EvaluationsResponse) String() string

type Resource

type Resource struct {
	Type       string           `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Id         string           `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	Properties *structpb.Struct `protobuf:"bytes,3,opt,name=properties,proto3" json:"properties,omitempty"`
	// contains filtered or unexported fields
}

func (*Resource) Descriptor deprecated

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

Deprecated: Use Resource.ProtoReflect.Descriptor instead.

func (*Resource) GetId

func (x *Resource) GetId() string

func (*Resource) GetProperties

func (x *Resource) GetProperties() *structpb.Struct

func (*Resource) GetType

func (x *Resource) GetType() string

func (*Resource) ProtoMessage

func (*Resource) ProtoMessage()

func (*Resource) ProtoReflect

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

func (*Resource) Reset

func (x *Resource) Reset()

func (*Resource) String

func (x *Resource) String() string

type Subject

type Subject struct {
	Type       string           `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Id         string           `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	Properties *structpb.Struct `protobuf:"bytes,3,opt,name=properties,proto3" json:"properties,omitempty"`
	// contains filtered or unexported fields
}

func (*Subject) Descriptor deprecated

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

Deprecated: Use Subject.ProtoReflect.Descriptor instead.

func (*Subject) GetId

func (x *Subject) GetId() string

func (*Subject) GetProperties

func (x *Subject) GetProperties() *structpb.Struct

func (*Subject) GetType

func (x *Subject) GetType() string

func (*Subject) ProtoMessage

func (*Subject) ProtoMessage()

func (*Subject) ProtoReflect

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

func (*Subject) Reset

func (x *Subject) Reset()

func (*Subject) String

func (x *Subject) String() string

type UnimplementedAccessServer

type UnimplementedAccessServer struct{}

UnimplementedAccessServer should be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedAccessServer) Evaluation

func (UnimplementedAccessServer) Evaluations

type UnsafeAccessServer

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

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

Jump to

Keyboard shortcuts

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