Documentation ¶
Index ¶
- type Header
- type Option
- type Source
- type TypedHeaderSource
- type ValidationUnit
- func (u *ValidationUnit) WithBearerToken(bearer *bearer.BearerToken) *ValidationUnit
- func (u *ValidationUnit) WithContainerID(v *cid.ID) *ValidationUnit
- func (u *ValidationUnit) WithHeaderSource(v TypedHeaderSource) *ValidationUnit
- func (u *ValidationUnit) WithOperation(v eacl.Operation) *ValidationUnit
- func (u *ValidationUnit) WithRole(v eacl.Role) *ValidationUnit
- func (u *ValidationUnit) WithSenderKey(v []byte) *ValidationUnit
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*cfg)
Option represents Validator option.
func WithEACLSource ¶ added in v0.24.0
func WithLogger ¶
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 ¶
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.