auth

package
v0.0.0-...-dfe2c77 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2025 License: MIT Imports: 5 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 {
	// Use the synchronous authorizer of Casbin
	*casbin.SyncedEnforcer
}

Authz defines an authorization engine, providing the authorization functionality.

func NewAuthz

func NewAuthz(db *gorm.DB, opts ...Option) (*Authz, error)

func (*Authz) Authorize

func (a *Authz) Authorize(sub, obj, act string) (bool, error)

type Option

type Option func(*authzConfig)

The Option defines a function option type, which is used to customize the behavior of NewAuthz.

func DefaultOptions

func DefaultOptions() []Option

DefaultOptions returns the default options for the authorization engine.

func WithAclModel

func WithAclModel(aclModel string) Option

WithAclModel sets the ACL model for the authorization engine.

func WithAutoLoadPolicyTime

func WithAutoLoadPolicyTime(autoLoadPolicyTime time.Duration) Option

WithAutoLoadPolicyTime sets the auto-load policy time for the authorization engine.

Jump to

Keyboard shortcuts

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