eacl

package
v0.27.4 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: GPL-3.0 Imports: 8 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 WithEACLSource added in v0.24.0

func WithEACLSource(v Source) Option

func WithLogger

func WithLogger(v *logger.Logger) Option

type Source added in v0.24.0

type Source interface {
	// GetEACL reads the table from the source 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 not in source.
	GetEACL(*cid.ID) (*eacl.Table, error)
}

Source is the interface that wraps basic methods of extended ACL table source.

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 *cid.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