Help us shape the future of Go! Take the 2026 Go Developer Survey

authorization

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PreAuthorizer

type PreAuthorizer interface {
	// PreAuthorize validates whether the user satisfies the necessary permissions
	// as defined by the RBAC policy. It examines the user’s roles, resource identifiers, and
	// the intended action to determine if the operation is allowed. Optional additional required permissions are also evaluated
	// against user.
	//
	// Return Value:
	//   - nil: indicates that the authorization check passed and the operation is permitted.
	//   - non-nil error: indicates that an error occurred during the permission evaluation process
	//     (for example, a failure decoding the manifest or other internal issues). If the evaluation
	//     completes successfully but identifies missing rules, then a nil error is returned along with
	//     the list (or slice) of missing rules. Note that in some cases the error may encapsulate multiple
	//     evaluation failures
	PreAuthorize(ctx context.Context, user user.Info, manifestReader io.Reader, additionalRequiredPerms ...UserAuthorizerAttributesFactory) ([]ScopedPolicyRules, error)
}

func NewRBACPreAuthorizer

func NewRBACPreAuthorizer(cl client.Client, opts ...RBACPreAuthorizerOption) PreAuthorizer

type RBACPreAuthorizerOption added in v1.9.0

type RBACPreAuthorizerOption func(*rbacPreAuthorizer)

func WithClusterCollectionVerbs added in v1.9.0

func WithClusterCollectionVerbs(verbs ...string) RBACPreAuthorizerOption

WithClusterCollectionVerbs configures cluster-scoped collection verbs (e.g. list, watch) that are checked in addition to object and namespaced collection verbs.

type ScopedPolicyRules

type ScopedPolicyRules struct {
	Namespace    string
	MissingRules []rbacv1.PolicyRule
}

type UserAuthorizerAttributesFactory added in v1.8.0

type UserAuthorizerAttributesFactory func(user user.Info) []authorizer.AttributesRecord

UserAuthorizerAttributesFactory is a function that produces a slice of AttributesRecord for user

Jump to

Keyboard shortcuts

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