authorizes

package
v0.30.113 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Access

func Access(
	handler miruken.Handler,
	action any,
	constraints ...any,
) (bool, *promise.Promise[bool], error)

Access performs authorization on `action`.

Types

type AccessDeniedError added in v0.30.6

type AccessDeniedError struct {
	Action any
}

AccessDeniedError indicates authorization failed.

func (*AccessDeniedError) Error added in v0.30.6

func (e *AccessDeniedError) Error() string

type Builder

type Builder struct {
	miruken.CallbackBuilder
	// contains filtered or unexported fields
}

Builder builds It callbacks.

func (*Builder) ForAction added in v0.30.2

func (b *Builder) ForAction(
	action any,
) *Builder

func (*Builder) New

func (b *Builder) New() *It

func (*Builder) WithSubject

func (b *Builder) WithSubject(
	subject security.Subject,
) *Builder

type It

type It struct {
	miruken.CallbackBase
	// contains filtered or unexported fields
}

It authorizes callbacks contravariantly.

func (*It) Dispatch

func (a *It) Dispatch(
	handler any,
	greedy bool,
	composer miruken.Handler,
) miruken.HandleResult

func (*It) Key

func (a *It) Key() any

func (*It) Policy

func (a *It) Policy() miruken.Policy

func (*It) Source

func (a *It) Source() any

func (*It) String

func (a *It) String() string

type Options

type Options struct {
	RequirePolicy bool
}

Options control the authorization process.

type Required added in v0.30.6

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

Required is a FilterProvider for authorization.

func (*Required) AppliesTo added in v0.30.6

func (r *Required) AppliesTo(
	callback miruken.Callback,
) bool

func (*Required) Filters added in v0.30.6

func (r *Required) Filters(
	binding miruken.Binding,
	callback any,
	composer miruken.Handler,
) ([]miruken.Filter, error)

func (*Required) InitWithTag added in v0.30.6

func (r *Required) InitWithTag(tag reflect.StructTag) error

func (*Required) Policy added in v0.30.6

func (r *Required) Policy() any

func (*Required) Required added in v0.30.6

func (r *Required) Required() bool

Jump to

Keyboard shortcuts

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