abac

package
v0.0.0-...-949c8fb Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type AuthService

type AuthService interface {
	GetActionSpecialAll() access.Action
	GetSubjectName() string
	GetSubject(ctx *fiber.Ctx) (Subject, error)
	GetEnv(ctx *fiber.Ctx) (any, error)
}

type Authorization

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

func NewAuthorizationService

func NewAuthorizationService(deps AuthorizationServiceDeps) *Authorization

func (*Authorization) Can

func (a *Authorization) Can(
	ctx *fiber.Ctx,
	action access.Action,
	resource Resource,
) bool

type AuthorizationServiceDeps

type AuthorizationServiceDeps struct {
	fx.In

	Logger  *logger.Logger
	Service AuthService
}

type Policy

type Policy interface {
	GetCondition() sql.StringNullable
	GetAction() access.Action
	GetEffect() access.Effect
	GetResource() sql.StringNullable
}

type Resource

type Resource interface {
	ResourceName() sql.StringNullable
}

type Subject

type Subject interface {
	GetPolicies() ([]Policy, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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