auth

package
v1.129.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 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 WithFieldSelectorFields

func WithFieldSelectorFields(fieldNames ...string) configFunc

WithFieldSelectorFields is a config function for setting the field selector fields. Field names are matched against the name of the object the requestor is associated with. For example, if the field name is '.spec.seedName' and the requestor is associated with seed 'foo', then they must send a field selector for '.spec.seedName=foo' in order to be authorized for list/watch requests. TODO(rfranzke): Remove this 'nolint' annotation once the function is used.

func WithLabelSelectorKeys

func WithLabelSelectorKeys(labelKeys ...string) configFunc

WithLabelSelectorKeys is a config function for setting the label selector keys. Label keys must contain the name of the object the requestor is associated with. For example, if the label key is 'name.seed.gardener.cloud/foo' and the requestor is associated with seed 'foo', then they must send a label selector for 'name.seed.gardener.cloud/foo=true' in order to be authorized for list/watch requests. 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