authz

package
v0.36.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyGitHubAuthClientConfig = NetworkACLConfig{}
)
View Source
var (
	EmptyPrincipalACLConfig = PrincipalACLConfig{}
)

Functions

func PrincipalACLHandlerFunc

func PrincipalACLHandlerFunc(cfg PrincipalACLConfig, logger zerolog.Logger, next http.Handler) http.HandlerFunc

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 {
	Config NetworkACLConfig
	// 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"`
}

func (NetworkACLConfig) IsEmpty

func (n NetworkACLConfig) IsEmpty() bool

type PrincipalACLConfig

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

func (PrincipalACLConfig) IsEmpty

func (c PrincipalACLConfig) IsEmpty() bool

type PrincipalACLHandler

type PrincipalACLHandler struct {
	Config PrincipalACLConfig
	Logger zerolog.Logger
	// contains filtered or unexported fields
}

func (PrincipalACLHandler) ServeHTTP

func (h PrincipalACLHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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