acl

package
v1.0.47 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFieldDataType

func GetFieldDataType(s string) (string, string)

GetFieldDataType return data type for a particular data field.

func MatchPathBasedACL

func MatchPathBasedACL(pattern, uri string) bool

MatchPathBasedACL matches pattern in a URI.

Types

type AccessList

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

AccessList is a collection of access list rules.

func NewAccessList

func NewAccessList() *AccessList

NewAccessList returns an instance of AccessList.

func (*AccessList) AddRule

func (acl *AccessList) AddRule(ctx context.Context, cfg *RuleConfiguration) error

AddRule adds a rule to AccessList.

func (*AccessList) AddRules

func (acl *AccessList) AddRules(ctx context.Context, cfgs []*RuleConfiguration) error

AddRules adds multiple rules to AccessList.

func (*AccessList) Allow

func (acl *AccessList) Allow(ctx context.Context, data map[string]interface{}) bool

Allow takes in client identity and metadata and returns an error when denied access.

func (*AccessList) AsMap

func (acl *AccessList) AsMap() map[string]interface{}

AsMap returns acl configuration as map.

func (*AccessList) GetRules

func (acl *AccessList) GetRules() []*RuleConfiguration

GetRules returns configured ACL rules.

func (*AccessList) SetDefaultAllowAction

func (acl *AccessList) SetDefaultAllowAction()

SetDefaultAllowAction sets default allow for the AccessList, i.e. the AccessList fails open.

func (*AccessList) SetLogger

func (acl *AccessList) SetLogger(logger *zap.Logger)

SetLogger adds a logger to AccessList.

type RuleConfiguration

type RuleConfiguration struct {
	Comment    string   `json:"comment,omitempty" xml:"comment,omitempty" yaml:"comment,omitempty"`
	Conditions []string `json:"conditions,omitempty" xml:"conditions,omitempty" yaml:"conditions,omitempty"`
	Action     string   `json:"action,omitempty" xml:"action,omitempty" yaml:"action,omitempty"`
}

RuleConfiguration consists of a list of conditions and and actions

Jump to

Keyboard shortcuts

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