authz

package
v0.43.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPrincipalAuthorised added in v0.40.0

func IsPrincipalAuthorised(user string, allowList []string, denyList []string) bool

Types

type Listener

type Listener struct {
	NetworkACL *NetworkACL
	Listener   net.Listener
	Logger     zerolog.Logger
}

func (*Listener) Accept

func (l *Listener) Accept() (net.Conn, error)

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

func (*Listener) Close

func (l *Listener) Close() error

type NetworkACL

type NetworkACL struct {
	AllowByDefault bool
	// contains filtered or unexported fields
}

func NewNetworkACL

func NewNetworkACL(cfg NetworkACLConfig) (*NetworkACL, error)

func (*NetworkACL) Allow

func (a *NetworkACL) Allow(n *net.IPNet)

func (*NetworkACL) AllowFromString

func (a *NetworkACL) AllowFromString(n string) error

func (*NetworkACL) Authorise

func (a *NetworkACL) Authorise(addr *net.TCPAddr) bool

Authorise if both allow is checked first, if empty if ip is in allow but also matches deny, authorisation is denied this is to allow people to deny subsets of allowed CIDR ranges.

func (*NetworkACL) AuthoriseConn

func (a *NetworkACL) AuthoriseConn(c net.Conn) (bool, error)

func (*NetworkACL) AuthoriseFromString

func (a *NetworkACL) AuthoriseFromString(addr string) (bool, error)

func (*NetworkACL) Deny

func (a *NetworkACL) Deny(net *net.IPNet)

func (*NetworkACL) DenyFromString

func (a *NetworkACL) DenyFromString(n string) error

type NetworkACLConfig

type NetworkACLConfig struct {
	AllowedNets    []string `mapstructure:"allow"`
	DeniedNets     []string `mapstructure:"deny"`
	AllowByDefault bool     `mapstructure:"allow-by-default"`
}

type PrincipalACLConfig

type PrincipalACLConfig struct {
	AllowList []string `mapstructure:"allow-list"`
	DenyList  []string `mapstructure:"deny-list"`
}

Jump to

Keyboard shortcuts

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