binding

package
v0.29.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	All               = []string{all}
	AllSet            = sets.New(All...)
	DefaultReadVerbs  = []string{"get", "list", "watch"}
	DefaultWriteVerbs = []string{"get", "list", "watch", "create", "update", "delete", "patch"}
)

Functions

func Matches

func Matches(str string, allowed []string) bool

Types

type Binding

type Binding interface {
	MatchesUser(user user.Info) bool
	GetUsers() sets.Set[string]
	GetGroups() sets.Set[string]
	GetRules() []Rule
	GetID() string
}

func ForNamespaceBinding

func ForNamespaceBinding(namespace string, binding Binding) Binding

ForNamespaceBinding will augment to existing rule to only match the specified namespace. If the passed in rule does not allow all namespace or the specified namespace, the augmented rule will fail to match any attributes.

func ForUser

func ForUser(username string, binding Binding) Binding

ForUser will create a new binding that will match just this user and will ignore the MatchUser behavior of the passed in binding

type DefaultBinding

type DefaultBinding struct {
	Name   string
	Users  sets.Set[string]
	Groups sets.Set[string]
	Rules  []Rule
}

func (*DefaultBinding) GetGroups

func (b *DefaultBinding) GetGroups() sets.Set[string]

func (*DefaultBinding) GetID

func (b *DefaultBinding) GetID() string

func (*DefaultBinding) GetRules

func (b *DefaultBinding) GetRules() []Rule

func (*DefaultBinding) GetUsers

func (b *DefaultBinding) GetUsers() sets.Set[string]

func (*DefaultBinding) MatchesUser

func (b *DefaultBinding) MatchesUser(user user.Info) bool

type DefaultRule

type DefaultRule struct {
	Namespaces    []string
	APIGroups     []string
	Resources     []string
	SubResources  []string
	ResourceNames []string
	Verbs         []string
	Paths         []string
}

func (*DefaultRule) GetAPIGroups

func (r *DefaultRule) GetAPIGroups() []string

func (*DefaultRule) GetNamespaces

func (r *DefaultRule) GetNamespaces() []string

func (*DefaultRule) GetPaths

func (r *DefaultRule) GetPaths() []string

func (*DefaultRule) GetResourceNames

func (r *DefaultRule) GetResourceNames() []string

func (*DefaultRule) GetResources

func (r *DefaultRule) GetResources() []string

func (*DefaultRule) GetSubResources

func (r *DefaultRule) GetSubResources() []string

func (*DefaultRule) GetVerbs

func (r *DefaultRule) GetVerbs() []string

func (*DefaultRule) Matches

func (r *DefaultRule) Matches(attr authorizer.Attributes) bool

type Rule

type Rule interface {
	Matches(attr authorizer.Attributes) bool
	GetNamespaces() []string
	GetAPIGroups() []string
	GetResources() []string
	GetSubResources() []string
	GetResourceNames() []string
	GetVerbs() []string
	GetPaths() []string
}

func ForNamespace

func ForNamespace(namespace string, rule Rule) Rule

ForNamespace will augment to existing rule to only match the specified namespace. If the passed in rule does not allow all namespace or the specified namespace, the augmented rule will fail to match any attributes.

Jump to

Keyboard shortcuts

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