auth

package
v1.136.3 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckNamespace added in v1.130.0

func CheckNamespace(log logr.Logger, attrs auth.Attributes, allowedNamespaces ...string) (bool, string)

CheckNamespace checks if namespace verbs in the attributes is allowed for the resource type.

func CheckSubresource

func CheckSubresource(log logr.Logger, attrs auth.Attributes, allowedSubresources ...string) (bool, string)

CheckSubresource checks if the subresource in the attributes is allowed for the resource type. If no subresource is provided in the attributes, the check always passes.

func CheckVerb

func CheckVerb(log logr.Logger, attrs auth.Attributes, allowedVerbs ...string) (bool, string)

CheckVerb checks if the verbs in the attributes is allowed for the resource type.

func WithAllowedNamespaces added in v1.130.0

func WithAllowedNamespaces(namespaceNames ...string) configFunc

WithAllowedNamespaces is a config function for setting the allowed namespaces.

func WithAllowedSubresources

func WithAllowedSubresources(resources ...string) configFunc

WithAllowedSubresources is a config function for setting the allowed subresources.

func WithAllowedVerbs

func WithAllowedVerbs(verbs ...string) configFunc

WithAllowedVerbs is a config function for setting the allowed verbs.

func WithAlwaysAllowedVerbs

func WithAlwaysAllowedVerbs(verbs ...string) configFunc

WithAlwaysAllowedVerbs is a config function for setting the always allowed verbs.

func WithFieldSelectors added in v1.130.0

func WithFieldSelectors(fields map[string]string) configFunc

WithFieldSelectors is a config function for setting the field selector field keys and values. In case multiple fields are provided, they are OR-ed, i.e., it is enough for a request to be authorized if one of the selectors matches.

func WithLabelSelectors added in v1.130.0

func WithLabelSelectors(labels map[string]string) configFunc

WithLabelSelectors is a config function for setting the label selector keys and values. In case multiple pairs are provided, they are OR-ed, i.e., it is enough for a request to be authorized if one of the selectors matches. TODO(rfranzke): Remove this 'nolint' annotation once the function is used.

Types

type RequestAuthorizer

type RequestAuthorizer struct {
	Log                    logr.Logger
	Graph                  graph.Interface
	AuthorizeWithSelectors authorizerwebhook.WithSelectorsChecker

	ToType      graph.VertexType
	ToNamespace string
	ToName      string
}

RequestAuthorizer contains common fields that can be used to authorize requests based on graph relationships.

func (*RequestAuthorizer) Check

func (a *RequestAuthorizer) Check(fromType graph.VertexType, attrs auth.Attributes, fns ...configFunc) (auth.Decision, string, error)

Check checks if a request is allowed based on the graph relationships and the provided attributes.

func (*RequestAuthorizer) CheckRead

func (a *RequestAuthorizer) CheckRead(fromType graph.VertexType, attrs auth.Attributes) (auth.Decision, string, error)

CheckRead checks if a read request (get, list, watch) is allowed based on the graph relationships and the provided attributes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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