acl

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const AnonymousPrincipal = "anonymous"

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string
const (
	ActionAny        Action = "*"
	ActionProduce    Action = "produce"
	ActionFetch      Action = "fetch"
	ActionGroupRead  Action = "group_read"
	ActionGroupWrite Action = "group_write"
	ActionGroupAdmin Action = "group_admin"
	ActionAdmin      Action = "admin"
)

type Authorizer

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

func NewAuthorizer

func NewAuthorizer(cfg Config) *Authorizer

func (*Authorizer) Allows

func (a *Authorizer) Allows(principal string, action Action, resource Resource, name string) bool

func (*Authorizer) Enabled

func (a *Authorizer) Enabled() bool

func (*Authorizer) KafkaBindings added in v2.2.0

func (a *Authorizer) KafkaBindings() []KafkaBinding

type Config

type Config struct {
	Enabled       bool             `json:"enabled"`
	DefaultPolicy string           `json:"default_policy"`
	Principals    []PrincipalRules `json:"principals"`
}

type KafkaBinding added in v2.2.0

type KafkaBinding struct {
	ResourceType kmsg.ACLResourceType
	ResourceName string
	PatternType  kmsg.ACLResourcePatternType
	Principal    string
	Host         string
	Operation    kmsg.ACLOperation
	Permission   kmsg.ACLPermissionType
}

type PrincipalRules

type PrincipalRules struct {
	Name  string `json:"name"`
	Allow []Rule `json:"allow"`
	Deny  []Rule `json:"deny"`
}

type Resource

type Resource string
const (
	ResourceAny     Resource = "*"
	ResourceTopic   Resource = "topic"
	ResourceGroup   Resource = "group"
	ResourceCluster Resource = "cluster"
)

type Rule

type Rule struct {
	Action   Action   `json:"action"`
	Resource Resource `json:"resource"`
	Name     string   `json:"name"`
}

Jump to

Keyboard shortcuts

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