Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterAuthzServiceServer(s grpc.ServiceRegistrar, srv AuthzServiceServer)
- type AuthzServiceClient
- type AuthzServiceServer
- type BatchEvaluateRequest
- func (*BatchEvaluateRequest) Descriptor() ([]byte, []int)deprecated
- func (x *BatchEvaluateRequest) GetCapabilityCheck() bool
- func (x *BatchEvaluateRequest) GetRequests() []*EvaluateRequest
- func (*BatchEvaluateRequest) ProtoMessage()
- func (x *BatchEvaluateRequest) ProtoReflect() protoreflect.Message
- func (x *BatchEvaluateRequest) Reset()
- func (x *BatchEvaluateRequest) String() string
- type BatchEvaluateResponse
- func (*BatchEvaluateResponse) Descriptor() ([]byte, []int)deprecated
- func (x *BatchEvaluateResponse) GetResponses() []*EvaluateResponse
- func (*BatchEvaluateResponse) ProtoMessage()
- func (x *BatchEvaluateResponse) ProtoReflect() protoreflect.Message
- func (x *BatchEvaluateResponse) Reset()
- func (x *BatchEvaluateResponse) String() string
- type EvaluateRequest
- func (*EvaluateRequest) Descriptor() ([]byte, []int)deprecated
- func (x *EvaluateRequest) GetAction() string
- func (x *EvaluateRequest) GetContext() map[string]string
- func (x *EvaluateRequest) GetPackage() string
- func (x *EvaluateRequest) GetResource() *Resource
- func (x *EvaluateRequest) GetToken() string
- func (*EvaluateRequest) ProtoMessage()
- func (x *EvaluateRequest) ProtoReflect() protoreflect.Message
- func (x *EvaluateRequest) Reset()
- func (x *EvaluateRequest) String() string
- type EvaluateResponse
- func (*EvaluateResponse) Descriptor() ([]byte, []int)deprecated
- func (x *EvaluateResponse) GetAllowed() bool
- func (x *EvaluateResponse) GetObligations() map[string]string
- func (x *EvaluateResponse) GetReason() string
- func (*EvaluateResponse) ProtoMessage()
- func (x *EvaluateResponse) ProtoReflect() protoreflect.Message
- func (x *EvaluateResponse) Reset()
- func (x *EvaluateResponse) String() string
- type Resource
- func (*Resource) Descriptor() ([]byte, []int)deprecated
- func (x *Resource) GetAttributes() map[string]string
- func (x *Resource) GetId() string
- func (x *Resource) GetType() string
- func (*Resource) ProtoMessage()
- func (x *Resource) ProtoReflect() protoreflect.Message
- func (x *Resource) Reset()
- func (x *Resource) String() string
- type UnimplementedAuthzServiceServer
- type UnsafeAuthzServiceServer
Constants ¶
const ( AuthzService_Evaluate_FullMethodName = "/authz.v1.AuthzService/Evaluate" AuthzService_BatchEvaluate_FullMethodName = "/authz.v1.AuthzService/BatchEvaluate" )
Variables ¶
var AuthzService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "authz.v1.AuthzService", HandlerType: (*AuthzServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Evaluate", Handler: _AuthzService_Evaluate_Handler, }, { MethodName: "BatchEvaluate", Handler: _AuthzService_BatchEvaluate_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "authz/v1/authz.proto", }
AuthzService_ServiceDesc is the grpc.ServiceDesc for AuthzService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_authz_v1_authz_proto protoreflect.FileDescriptor
Functions ¶
func RegisterAuthzServiceServer ¶
func RegisterAuthzServiceServer(s grpc.ServiceRegistrar, srv AuthzServiceServer)
Types ¶
type AuthzServiceClient ¶
type AuthzServiceClient interface {
// Evaluate checks whether the subject encoded in token is permitted to
// perform action on resource, given the supplied context attributes.
Evaluate(ctx context.Context, in *EvaluateRequest, opts ...grpc.CallOption) (*EvaluateResponse, error)
// BatchEvaluate runs multiple independent Evaluate checks in a single
// round-trip. Responses are returned in the same order as the requests.
// Useful for filtering a list (e.g. which blueprints the user may launch).
BatchEvaluate(ctx context.Context, in *BatchEvaluateRequest, opts ...grpc.CallOption) (*BatchEvaluateResponse, error)
}
AuthzServiceClient is the client API for AuthzService 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.
AuthzService evaluates authorization requests against an OPA Rego policy stored on the server. The caller must supply a signed JWT; the service verifies the token and extracts subject claims before policy evaluation.
func NewAuthzServiceClient ¶
func NewAuthzServiceClient(cc grpc.ClientConnInterface) AuthzServiceClient
type AuthzServiceServer ¶
type AuthzServiceServer interface {
// Evaluate checks whether the subject encoded in token is permitted to
// perform action on resource, given the supplied context attributes.
Evaluate(context.Context, *EvaluateRequest) (*EvaluateResponse, error)
// BatchEvaluate runs multiple independent Evaluate checks in a single
// round-trip. Responses are returned in the same order as the requests.
// Useful for filtering a list (e.g. which blueprints the user may launch).
BatchEvaluate(context.Context, *BatchEvaluateRequest) (*BatchEvaluateResponse, error)
// contains filtered or unexported methods
}
AuthzServiceServer is the server API for AuthzService service. All implementations must embed UnimplementedAuthzServiceServer for forward compatibility.
AuthzService evaluates authorization requests against an OPA Rego policy stored on the server. The caller must supply a signed JWT; the service verifies the token and extracts subject claims before policy evaluation.
type BatchEvaluateRequest ¶
type BatchEvaluateRequest struct {
Requests []*EvaluateRequest `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests,omitempty"`
// capability_check marks every request in this batch as a synthetic
// "what can I do" probe (e.g. built from authz.CapabilityChecks()) rather
// than a real access attempt. Policy-decision auditing should record and
// classify these separately from genuine authorization decisions.
CapabilityCheck bool `protobuf:"varint,2,opt,name=capability_check,json=capabilityCheck,proto3" json:"capability_check,omitempty"`
// contains filtered or unexported fields
}
BatchEvaluateRequest carries one or more independent checks.
func (*BatchEvaluateRequest) Descriptor
deprecated
func (*BatchEvaluateRequest) Descriptor() ([]byte, []int)
Deprecated: Use BatchEvaluateRequest.ProtoReflect.Descriptor instead.
func (*BatchEvaluateRequest) GetCapabilityCheck ¶ added in v0.32.1
func (x *BatchEvaluateRequest) GetCapabilityCheck() bool
func (*BatchEvaluateRequest) GetRequests ¶
func (x *BatchEvaluateRequest) GetRequests() []*EvaluateRequest
func (*BatchEvaluateRequest) ProtoMessage ¶
func (*BatchEvaluateRequest) ProtoMessage()
func (*BatchEvaluateRequest) ProtoReflect ¶
func (x *BatchEvaluateRequest) ProtoReflect() protoreflect.Message
func (*BatchEvaluateRequest) Reset ¶
func (x *BatchEvaluateRequest) Reset()
func (*BatchEvaluateRequest) String ¶
func (x *BatchEvaluateRequest) String() string
type BatchEvaluateResponse ¶
type BatchEvaluateResponse struct {
Responses []*EvaluateResponse `protobuf:"bytes,1,rep,name=responses,proto3" json:"responses,omitempty"`
// contains filtered or unexported fields
}
BatchEvaluateResponse carries one response per request, in the same order.
func (*BatchEvaluateResponse) Descriptor
deprecated
func (*BatchEvaluateResponse) Descriptor() ([]byte, []int)
Deprecated: Use BatchEvaluateResponse.ProtoReflect.Descriptor instead.
func (*BatchEvaluateResponse) GetResponses ¶
func (x *BatchEvaluateResponse) GetResponses() []*EvaluateResponse
func (*BatchEvaluateResponse) ProtoMessage ¶
func (*BatchEvaluateResponse) ProtoMessage()
func (*BatchEvaluateResponse) ProtoReflect ¶
func (x *BatchEvaluateResponse) ProtoReflect() protoreflect.Message
func (*BatchEvaluateResponse) Reset ¶
func (x *BatchEvaluateResponse) Reset()
func (*BatchEvaluateResponse) String ¶
func (x *BatchEvaluateResponse) String() string
type EvaluateRequest ¶
type EvaluateRequest struct {
// token is the signed JWT for the already-authenticated user.
// The service verifies the signature and extracts claims as the OPA subject.
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
// action is the operation being attempted, in "resource_type:verb" form.
// Examples: "blueprint:launch", "workspace:delete", "app:access".
Action string `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"`
// resource is the object the action is being performed on.
Resource *Resource `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"`
// context carries ambient attributes not present in the JWT or resource,
// e.g. "namespace", "environment", "team".
Context map[string]string `` /* 141-byte string literal not displayed */
// package is the OPA policy package to evaluate the request against
Package string `protobuf:"bytes,5,opt,name=package,proto3" json:"package,omitempty"`
// contains filtered or unexported fields
}
EvaluateRequest is the input to a single authorization check.
func (*EvaluateRequest) Descriptor
deprecated
func (*EvaluateRequest) Descriptor() ([]byte, []int)
Deprecated: Use EvaluateRequest.ProtoReflect.Descriptor instead.
func (*EvaluateRequest) GetAction ¶
func (x *EvaluateRequest) GetAction() string
func (*EvaluateRequest) GetContext ¶
func (x *EvaluateRequest) GetContext() map[string]string
func (*EvaluateRequest) GetPackage ¶
func (x *EvaluateRequest) GetPackage() string
func (*EvaluateRequest) GetResource ¶
func (x *EvaluateRequest) GetResource() *Resource
func (*EvaluateRequest) GetToken ¶
func (x *EvaluateRequest) GetToken() string
func (*EvaluateRequest) ProtoMessage ¶
func (*EvaluateRequest) ProtoMessage()
func (*EvaluateRequest) ProtoReflect ¶
func (x *EvaluateRequest) ProtoReflect() protoreflect.Message
func (*EvaluateRequest) Reset ¶
func (x *EvaluateRequest) Reset()
func (*EvaluateRequest) String ¶
func (x *EvaluateRequest) String() string
type EvaluateResponse ¶
type EvaluateResponse struct {
// allowed is true when the policy permits the action.
Allowed bool `protobuf:"varint,1,opt,name=allowed,proto3" json:"allowed,omitempty"`
// reason is a human-readable explanation of the decision.
// Populated on both allow and deny.
Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"`
// obligations carries effective attributes after policy enforcement.
// Callers must apply these key/value pairs to the resource or request
// before proceeding — e.g. forcing "privileged" to "false" for non-admins.
// Empty when the policy imposes no additional constraints.
Obligations map[string]string `` /* 149-byte string literal not displayed */
// contains filtered or unexported fields
}
EvaluateResponse is the result of a single authorization check.
func (*EvaluateResponse) Descriptor
deprecated
func (*EvaluateResponse) Descriptor() ([]byte, []int)
Deprecated: Use EvaluateResponse.ProtoReflect.Descriptor instead.
func (*EvaluateResponse) GetAllowed ¶
func (x *EvaluateResponse) GetAllowed() bool
func (*EvaluateResponse) GetObligations ¶
func (x *EvaluateResponse) GetObligations() map[string]string
func (*EvaluateResponse) GetReason ¶
func (x *EvaluateResponse) GetReason() string
func (*EvaluateResponse) ProtoMessage ¶
func (*EvaluateResponse) ProtoMessage()
func (*EvaluateResponse) ProtoReflect ¶
func (x *EvaluateResponse) ProtoReflect() protoreflect.Message
func (*EvaluateResponse) Reset ¶
func (x *EvaluateResponse) Reset()
func (*EvaluateResponse) String ¶
func (x *EvaluateResponse) String() string
type Resource ¶
type Resource struct {
// type is the resource kind: "blueprint", "workspace", "app", etc.
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
// id is the resource name or unique identifier.
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
// attributes carries ABAC metadata about the resource, e.g.:
//
// "owner" -> username
// "org" -> organization
// "visibility" -> "public" | "private"
Attributes map[string]string `` /* 147-byte string literal not displayed */
// contains filtered or unexported fields
}
Resource identifies the object being acted upon.
func (*Resource) Descriptor
deprecated
func (*Resource) GetAttributes ¶
func (*Resource) ProtoMessage ¶
func (*Resource) ProtoMessage()
func (*Resource) ProtoReflect ¶
func (x *Resource) ProtoReflect() protoreflect.Message
type UnimplementedAuthzServiceServer ¶
type UnimplementedAuthzServiceServer struct{}
UnimplementedAuthzServiceServer must 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 (UnimplementedAuthzServiceServer) BatchEvaluate ¶
func (UnimplementedAuthzServiceServer) BatchEvaluate(context.Context, *BatchEvaluateRequest) (*BatchEvaluateResponse, error)
func (UnimplementedAuthzServiceServer) Evaluate ¶
func (UnimplementedAuthzServiceServer) Evaluate(context.Context, *EvaluateRequest) (*EvaluateResponse, error)
type UnsafeAuthzServiceServer ¶
type UnsafeAuthzServiceServer interface {
// contains filtered or unexported methods
}
UnsafeAuthzServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AuthzServiceServer will result in compilation errors.