authz

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("chef authorization not implemented")

Functions

This section is empty.

Types

type ACL

type ACL struct {
	Create Permission `json:"create"`
	Read   Permission `json:"read"`
	Update Permission `json:"update"`
	Delete Permission `json:"delete"`
	Grant  Permission `json:"grant"`
}

type ACLAuthorizer

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

func NewACLAuthorizer

func NewACLAuthorizer(resolver ACLResolver) ACLAuthorizer

func (ACLAuthorizer) Authorize

func (a ACLAuthorizer) Authorize(ctx context.Context, subject Subject, action Action, resource Resource) (Decision, error)

func (ACLAuthorizer) Name

func (ACLAuthorizer) Name() string

type ACLResolver

type ACLResolver interface {
	ResolveACL(context.Context, Resource) (ACL, bool, error)
	GroupsFor(context.Context, Subject) ([]string, error)
}

type Action

type Action string
const (
	ActionRead   Action = "read"
	ActionCreate Action = "create"
	ActionUpdate Action = "update"
	ActionDelete Action = "delete"
	ActionGrant  Action = "grant"
)

type Authorizer

type Authorizer interface {
	Name() string
	Authorize(context.Context, Subject, Action, Resource) (Decision, error)
}

type Decision

type Decision struct {
	Allowed bool   `json:"allowed"`
	Reason  string `json:"reason"`
}

type NoopAuthorizer

type NoopAuthorizer struct{}

func (NoopAuthorizer) Authorize

func (NoopAuthorizer) Name

func (NoopAuthorizer) Name() string

type Permission

type Permission struct {
	Actors []string `json:"actors"`
	Groups []string `json:"groups"`
}

type Resource

type Resource struct {
	Type         string `json:"type"`
	Name         string `json:"name"`
	Organization string `json:"organization,omitempty"`
}

type Subject

type Subject struct {
	Type         string `json:"type"`
	Name         string `json:"name"`
	Organization string `json:"organization,omitempty"`
}

Jump to

Keyboard shortcuts

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