acl

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMiddleware

func CheckMiddleware(next http.Handler) http.Handler

HTTPMiddleware

func Match

func Match(route []string, topic []string) bool

Match compare an selector route with an given topic

func MatchRoute

func MatchRoute(route string, topic string) (match bool)

MatchRoute compare an route with an topic

func PatchConfigFromJson

func PatchConfigFromJson(jsondata []byte) (err error)

APPEND rules in the config to existing config ( or create if user not exist )

func SetConfigFromJson

func SetConfigFromJson(jsondata []byte) (err error)

OVERWRITE the whole config use this usualy in a PUT-Request

Types

type ConfigStruct

type ConfigStruct struct {
	Middlewares struct {
		Acl struct {
			Rules map[string][]string `yaml:"rules" json:"rules"`
		} `yaml:"acl" json:"acl"`
	} `yaml:"middlewares" json:"middlewares"`
}

type Middleware

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

func (Middleware) HasAccess

func (mdw Middleware) HasAccess(username string, route string) (hasAccess bool)

HasAccess check if the given user has access to this route

func (*Middleware) Init

func (mdw *Middleware) Init()

func (*Middleware) PatchConfigFromJson

func (mdw *Middleware) PatchConfigFromJson(jsondata []byte) (err error)

func (*Middleware) SetConfigFromJson

func (mdw *Middleware) SetConfigFromJson(jsondata []byte) (err error)

Jump to

Keyboard shortcuts

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