authz

package
v0.0.0-...-1a3a2fa Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const RBACCtxKey rbacCtxKey = "rbac"

Variables

View Source
var (
	ErrBadSubject   = errors.New("bad subject in token")
	ErrAccessDenied = errors.New("access denied")
)
View Source
var (
	ErrNotAuthorized = errors.New("not authorized")
)

Functions

func Check

func Check(ctx context.Context, res restrict.Resource, opts ...CheckOption) (entities.Subject, error)

Check is a convenience function to pull the RBAC instance out of ctx and Check.

func CtxWithRBAC

func CtxWithRBAC(ctx context.Context, rbac RBAC) context.Context

func IsErrAccessDenied

func IsErrAccessDenied(err error) error

func New

func New(pol *restrict.PolicyDefinition) (*rbac, error)

func UseResource

func UseResource(rsc string) restrict.Resource

Types

type CheckOption

type CheckOption func(*checkOptions)

func WithActions

func WithActions(actions ...string) CheckOption

func WithContext

func WithContext(ctx restrict.Context) CheckOption

func WithTry

func WithTry() CheckOption

WithTry indicates that failures should not be logged.

type RBAC

type RBAC interface {
	Check(ctx context.Context, res restrict.Resource, opts ...CheckOption) (entities.Subject, error)
}

func FromCtx

func FromCtx(ctx context.Context) RBAC

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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