eacl

package
v0.13.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header interface {
	Key() string
	Value() string
}

Header is an interface of string key-value header.

type Option

type Option func(*cfg)

Option represents Validator option.

func WithEACLStorage

func WithEACLStorage(v Storage) Option

func WithLogger

func WithLogger(v *logger.Logger) Option

func WithMorphClient

func WithMorphClient(v *wrapper.Wrapper) Option

type Storage

type Storage interface {
	// GetEACL reads the table from the storage by identifier.
	// It returns any error encountered.
	//
	// GetEACL must return exactly one non-nil value.
	//
	// Must return pkg/core/container.ErrEACLNotFound if requested
	// eACL table is is not in storage.
	GetEACL(*container.ID) (*eacl.Table, error)
}

Storage is the interface that wraps basic methods of extended ACL table storage.

type TypedHeaderSource

type TypedHeaderSource interface {
	// HeadersOfType returns the list of key-value headers
	// of particular type.
	//
	// It returns any problem encountered through the boolean
	// false value.
	HeadersOfType(eacl.FilterHeaderType) ([]Header, bool)
}

TypedHeaderSource is the interface that wraps method for selecting typed headers by type.

type ValidationUnit

type ValidationUnit struct {
	// contains filtered or unexported fields
}

ValidationUnit represents unit of check for Validator.

func (*ValidationUnit) WithBearerToken

func (u *ValidationUnit) WithBearerToken(bearer *bearer.BearerToken) *ValidationUnit

func (*ValidationUnit) WithContainerID

func (u *ValidationUnit) WithContainerID(v *container.ID) *ValidationUnit

func (*ValidationUnit) WithHeaderSource

func (u *ValidationUnit) WithHeaderSource(v TypedHeaderSource) *ValidationUnit

func (*ValidationUnit) WithOperation

func (u *ValidationUnit) WithOperation(v eacl.Operation) *ValidationUnit

func (*ValidationUnit) WithRole

func (u *ValidationUnit) WithRole(v eacl.Role) *ValidationUnit

func (*ValidationUnit) WithSenderKey

func (u *ValidationUnit) WithSenderKey(v []byte) *ValidationUnit

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator is a tool that calculates the action on a request according to the extended ACL rule table.

func NewValidator

func NewValidator(opts ...Option) *Validator

NewValidator creates and initializes a new Validator using options.

func (*Validator) CalculateAction

func (v *Validator) CalculateAction(unit *ValidationUnit) eacl.Action

CalculateAction calculates action on the request according to its information represented in ValidationUnit.

The action is calculated according to the application of eACL table of rules to the request.

If the eACL table is not available at the time of the call, eacl.ActionUnknown is returned.

If no matching table entry is found, ActionAllow is returned.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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