authz

package
v0.6.19 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authz

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

func New

func New(
	log log.Logger,
	next http.Handler,
	userIDHeaderKey string,
	resourceService ResourceService,
	userService UserService,
	groupService GroupService) *Authz

func (Authz) Info

func (c Authz) Info() *middleware.MiddlewareInfo

func (*Authz) ServeHTTP

func (c *Authz) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type Config

type Config struct {
	Actions     []string                        `yaml:"actions" mapstructure:"actions"`
	Permissions []Permission                    `yaml:"permissions" mapstructure:"permissions"`
	Attributes  map[string]middleware.Attribute `yaml:"attributes" mapstructure:"attributes"`
}

type GroupService added in v0.6.6

type GroupService interface {
	GetBySlug(ctx context.Context, slug string) (group.Group, error)
}

type Permission

type Permission struct {
	Name       string                `yaml:"name" mapstructure:"name"`
	Namespace  string                `yaml:"namespace" mapstructure:"namespace"`
	Attribute  string                `yaml:"attribute" mapstructure:"attribute"`
	Expression expression.Expression `yaml:"expression" mapstructure:"expression"`
}

type ResourceService

type ResourceService interface {
	CheckAuthz(ctx context.Context, resource resource.Resource, act action.Action) (bool, error)
}

type UserService

type UserService interface {
	FetchCurrentUser(ctx context.Context) (user.User, error)
}

Jump to

Keyboard shortcuts

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