authz

package
v0.0.0-...-3511abf Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPermissionDenied

func IsPermissionDenied(err error) bool

IsPermissionDenied checks if err is of type PermissionDeniedError.

func ObfuscateAgent

func ObfuscateAgent(agent *agentv1.Agent) error

ObfuscateAgent obfuscates sensitive information in given Agent.

func ObfuscateContainer

func ObfuscateContainer(container *containerv1.Container) error

ObfuscateContainer obfuscates sensitive information in given Container.

func ObfuscateDevice

func ObfuscateDevice(device *devicev1.Device) error

ObfuscateDevice obfuscates sensitive information in given Device.

func ObfuscateJob

func ObfuscateJob(job *jobv1.Job) jobv1.LimitedJob

ObfuscateJob obfuscates sensitive information in given Job.

func ObfuscateSlot

func ObfuscateSlot(slot *agentv1.Slot) error

ObfuscateSlot obfuscates sensitive information in given Slot.

func SubIfUnauthorized

func SubIfUnauthorized(err error, sub error) error

SubIfUnauthorized substitutes an error if it is of type PermissionDeniedError.

Types

type AuthZProviderType

type AuthZProviderType[T any] struct {
	// contains filtered or unexported fields
}

AuthZProviderType is a per-module registry for authz implementations.

func (*AuthZProviderType[T]) Get

func (p *AuthZProviderType[T]) Get() T

Get returns the selected implementation.

func (*AuthZProviderType[T]) Register

func (p *AuthZProviderType[T]) Register(authZType string, impl T)

Register adds new implementation.

type PermissionDeniedError

type PermissionDeniedError struct {
	RequiredPermissions []rbacv1.PermissionType
	OneOf               bool

	// optional prefix error message
	Prefix string
}

PermissionDeniedError represents an error that arises when a user does not have sufficient access privileges. RequiredPermissions can be empty for non-rbac errors.

func (PermissionDeniedError) Error

func (p PermissionDeniedError) Error() string

Error returns an error string.

func (PermissionDeniedError) WithPrefix

func (p PermissionDeniedError) WithPrefix(prefix string) PermissionDeniedError

WithPrefix adds a custom prefix to error string.

Jump to

Keyboard shortcuts

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