authorization

package
v0.5.11 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PermissionTypeHttpEndpoint represents all http resources
	PermissionTypeHttpEndpoint = "http_endpoint"
	// PermissionTypeEvictionPlugin represents the permission to register eviction plugin.
	PermissionTypeEvictionPlugin = "eviction_plugin"
	// PermissionTypeAll represents all permissions.
	PermissionTypeAll = "*"
)
View Source
const (
	AccessControlTypeInsecure    = "insecure"
	AccessControlTypeStatic      = "static"
	AccessControlTypeDynamicConf = "dynamic_conf"
)
View Source
const (
	ErrorMsgInvalidSubject = "there is no record associated to subject %v"
	ErrorMsgNoPermission   = "subject %v has no permission to resource %v"
)

Variables

This section is empty.

Functions

func GetAccessControlInitializer

func GetAccessControlInitializer() map[AccessControlType]NewAccessControlFunc

func RegisterAccessControlInitializer

func RegisterAccessControlInitializer(authType AccessControlType, initializer NewAccessControlFunc)

Types

type AccessControl

type AccessControl interface {
	// Verify verifies whether the subject passed in has the permission on the target resource.
	Verify(authInfo credential.AuthInfo, targetResource PermissionType) error
	// Run starts the AccessControl component
	Run(ctx context.Context)
}

AccessControl verifies whether the subject the AuthInfo holds has the permission on the target resource.

func DefaultAccessControl

func DefaultAccessControl() AccessControl

func GetAccessControl

func GetAccessControl(genericConf *generic.GenericConfiguration, dynamicConfig *dynamic.DynamicAgentConfiguration) (AccessControl, error)

func NewDynamicConfAccessControl

func NewDynamicConfAccessControl(_ *generic.AuthConfiguration, dynamicConfig *dynamic.DynamicAgentConfiguration) (AccessControl, error)

type AccessControlType

type AccessControlType string

type AuthRule

type AuthRule map[string][]PermissionType

type NewAccessControlFunc

type NewAccessControlFunc func(authConfig *generic.AuthConfiguration, dynamicConfig *dynamic.DynamicAgentConfiguration) (AccessControl, error)

type PermissionType

type PermissionType string

Jump to

Keyboard shortcuts

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