authzv1

package
v0.0.0-...-f507469 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package authzv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	AuthzAPI_Check_FullMethodName = "/clutch.authz.v1.AuthzAPI/Check"
)

Variables

View Source
var (
	Decision_name = map[int32]string{
		0: "UNSPECIFIED",
		1: "DENY",
		2: "ALLOW",
	}
	Decision_value = map[string]int32{
		"UNSPECIFIED": 0,
		"DENY":        1,
		"ALLOW":       2,
	}
)

Enum value maps for Decision.

View Source
var AuthzAPI_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "clutch.authz.v1.AuthzAPI",
	HandlerType: (*AuthzAPIServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Check",
			Handler:    _AuthzAPI_Check_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "authz/v1/authz.proto",
}

AuthzAPI_ServiceDesc is the grpc.ServiceDesc for AuthzAPI 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_authz_v1_authz_proto protoreflect.FileDescriptor

Functions

func RegisterAuthzAPIHandler

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

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

func RegisterAuthzAPIHandlerClient

func RegisterAuthzAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthzAPIClient) error

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

func RegisterAuthzAPIHandlerFromEndpoint

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

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

func RegisterAuthzAPIHandlerServer

func RegisterAuthzAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthzAPIServer) error

RegisterAuthzAPIHandlerServer registers the http handlers for service AuthzAPI to "mux". UnaryRPC :call AuthzAPIServer 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 RegisterAuthzAPIHandlerFromEndpoint instead.

func RegisterAuthzAPIServer

func RegisterAuthzAPIServer(s grpc.ServiceRegistrar, srv AuthzAPIServer)

Types

type AuthzAPIClient

type AuthzAPIClient interface {
	Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error)
}

AuthzAPIClient is the client API for AuthzAPI 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 NewAuthzAPIClient

func NewAuthzAPIClient(cc grpc.ClientConnInterface) AuthzAPIClient

type AuthzAPIServer

type AuthzAPIServer interface {
	Check(context.Context, *CheckRequest) (*CheckResponse, error)
}

AuthzAPIServer is the server API for AuthzAPI service. All implementations should embed UnimplementedAuthzAPIServer for forward compatibility

type CheckRequest

type CheckRequest struct {
	Subject    *Subject      `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"`
	Method     string        `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"`
	ActionType v1.ActionType `protobuf:"varint,3,opt,name=action_type,json=actionType,proto3,enum=clutch.api.v1.ActionType" json:"action_type,omitempty"`
	Resource   string        `protobuf:"bytes,4,opt,name=resource,proto3" json:"resource,omitempty"`
	// contains filtered or unexported fields
}

func (*CheckRequest) Descriptor deprecated

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

Deprecated: Use CheckRequest.ProtoReflect.Descriptor instead.

func (*CheckRequest) GetActionType

func (x *CheckRequest) GetActionType() v1.ActionType

func (*CheckRequest) GetMethod

func (x *CheckRequest) GetMethod() string

func (*CheckRequest) GetResource

func (x *CheckRequest) GetResource() string

func (*CheckRequest) GetSubject

func (x *CheckRequest) GetSubject() *Subject

func (*CheckRequest) ProtoMessage

func (*CheckRequest) ProtoMessage()

func (*CheckRequest) ProtoReflect

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

func (*CheckRequest) Reset

func (x *CheckRequest) Reset()

func (*CheckRequest) String

func (x *CheckRequest) String() string

func (*CheckRequest) Validate

func (m *CheckRequest) Validate() error

Validate checks the field values on CheckRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*CheckRequest) ValidateAll

func (m *CheckRequest) ValidateAll() error

ValidateAll checks the field values on CheckRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in CheckRequestMultiError, or nil if none found.

type CheckRequestMultiError

type CheckRequestMultiError []error

CheckRequestMultiError is an error wrapping multiple validation errors returned by CheckRequest.ValidateAll() if the designated constraints aren't met.

func (CheckRequestMultiError) AllErrors

func (m CheckRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (CheckRequestMultiError) Error

func (m CheckRequestMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type CheckRequestValidationError

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

CheckRequestValidationError is the validation error returned by CheckRequest.Validate if the designated constraints aren't met.

func (CheckRequestValidationError) Cause

Cause function returns cause value.

func (CheckRequestValidationError) Error

Error satisfies the builtin error interface

func (CheckRequestValidationError) ErrorName

func (e CheckRequestValidationError) ErrorName() string

ErrorName returns error name.

func (CheckRequestValidationError) Field

Field function returns field value.

func (CheckRequestValidationError) Key

Key function returns key value.

func (CheckRequestValidationError) Reason

Reason function returns reason value.

type CheckResponse

type CheckResponse struct {
	Decision Decision `protobuf:"varint,1,opt,name=decision,proto3,enum=clutch.authz.v1.Decision" json:"decision,omitempty"`
	// contains filtered or unexported fields
}

func (*CheckResponse) Descriptor deprecated

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

Deprecated: Use CheckResponse.ProtoReflect.Descriptor instead.

func (*CheckResponse) GetDecision

func (x *CheckResponse) GetDecision() Decision

func (*CheckResponse) ProtoMessage

func (*CheckResponse) ProtoMessage()

func (*CheckResponse) ProtoReflect

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

func (*CheckResponse) Reset

func (x *CheckResponse) Reset()

func (*CheckResponse) String

func (x *CheckResponse) String() string

func (*CheckResponse) Validate

func (m *CheckResponse) Validate() error

Validate checks the field values on CheckResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*CheckResponse) ValidateAll

func (m *CheckResponse) ValidateAll() error

ValidateAll checks the field values on CheckResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in CheckResponseMultiError, or nil if none found.

type CheckResponseMultiError

type CheckResponseMultiError []error

CheckResponseMultiError is an error wrapping multiple validation errors returned by CheckResponse.ValidateAll() if the designated constraints aren't met.

func (CheckResponseMultiError) AllErrors

func (m CheckResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (CheckResponseMultiError) Error

func (m CheckResponseMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type CheckResponseValidationError

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

CheckResponseValidationError is the validation error returned by CheckResponse.Validate if the designated constraints aren't met.

func (CheckResponseValidationError) Cause

Cause function returns cause value.

func (CheckResponseValidationError) Error

Error satisfies the builtin error interface

func (CheckResponseValidationError) ErrorName

func (e CheckResponseValidationError) ErrorName() string

ErrorName returns error name.

func (CheckResponseValidationError) Field

Field function returns field value.

func (CheckResponseValidationError) Key

Key function returns key value.

func (CheckResponseValidationError) Reason

Reason function returns reason value.

type Decision

type Decision int32
const (
	Decision_UNSPECIFIED Decision = 0
	Decision_DENY        Decision = 1
	Decision_ALLOW       Decision = 2
)

func (Decision) Descriptor

func (Decision) Descriptor() protoreflect.EnumDescriptor

func (Decision) Enum

func (x Decision) Enum() *Decision

func (Decision) EnumDescriptor deprecated

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

Deprecated: Use Decision.Descriptor instead.

func (Decision) Number

func (x Decision) Number() protoreflect.EnumNumber

func (Decision) String

func (x Decision) String() string

func (Decision) Type

type Subject

type Subject struct {
	User   string   `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	Groups []string `protobuf:"bytes,2,rep,name=groups,proto3" json:"groups,omitempty"`
	// contains filtered or unexported fields
}

func (*Subject) Descriptor deprecated

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

Deprecated: Use Subject.ProtoReflect.Descriptor instead.

func (*Subject) GetGroups

func (x *Subject) GetGroups() []string

func (*Subject) GetUser

func (x *Subject) GetUser() 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

func (*Subject) Validate

func (m *Subject) Validate() error

Validate checks the field values on Subject with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Subject) ValidateAll

func (m *Subject) ValidateAll() error

ValidateAll checks the field values on Subject with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in SubjectMultiError, or nil if none found.

type SubjectMultiError

type SubjectMultiError []error

SubjectMultiError is an error wrapping multiple validation errors returned by Subject.ValidateAll() if the designated constraints aren't met.

func (SubjectMultiError) AllErrors

func (m SubjectMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (SubjectMultiError) Error

func (m SubjectMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type SubjectValidationError

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

SubjectValidationError is the validation error returned by Subject.Validate if the designated constraints aren't met.

func (SubjectValidationError) Cause

func (e SubjectValidationError) Cause() error

Cause function returns cause value.

func (SubjectValidationError) Error

func (e SubjectValidationError) Error() string

Error satisfies the builtin error interface

func (SubjectValidationError) ErrorName

func (e SubjectValidationError) ErrorName() string

ErrorName returns error name.

func (SubjectValidationError) Field

func (e SubjectValidationError) Field() string

Field function returns field value.

func (SubjectValidationError) Key

func (e SubjectValidationError) Key() bool

Key function returns key value.

func (SubjectValidationError) Reason

func (e SubjectValidationError) Reason() string

Reason function returns reason value.

type UnimplementedAuthzAPIServer

type UnimplementedAuthzAPIServer struct {
}

UnimplementedAuthzAPIServer should be embedded to have forward compatible implementations.

func (UnimplementedAuthzAPIServer) Check

type UnsafeAuthzAPIServer

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

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

Jump to

Keyboard shortcuts

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