subjects

package
v1.0.55 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(c context.Context, loader Loader) error

Setup 把主体绑定到上下文中

Types

type Loader

type Loader interface {
	Load(c context.Context) (Subject, error)
}

Loader 用于从上下文中加载 subject 对象

type Subject

type Subject interface {
	GetContext() context.Context

	GetToken() security.Token

	GetSession() security.Session

	HasRole(role rbac.RoleName) bool
}

Subject 表示当前的操作主体

func Current

func Current(c context.Context) (Subject, error)

Current 从上下文中提取当前主体

Jump to

Keyboard shortcuts

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