security

package module
v1.0.23 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 7 Imported by: 2

README

security

Starter for using Session Security

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModuleT added in v1.0.20

func ModuleT() *application.ModuleBuilder

ModuleT 导出模块[github.com/starter-go/security]

Types

type Session added in v1.0.20

type Session interface {
	Get() *rbac.SessionDTO

	Set(s *rbac.SessionDTO)

	UserID() rbac.UserID

	UserName() rbac.UserName

	Nickname() string

	Avatar() string

	Roles() []rbac.RoleName

	Authenticated() bool
}

Session 代表当前会话

type SessionProvider added in v1.0.20

type SessionProvider interface {
	Support(c context.Context) bool
	Current(c context.Context) (Session, error)
}

SessionProvider 会话的实现方案

type SessionRegistration added in v1.0.20

type SessionRegistration struct {
	Name     string
	Enabled  bool
	Priority int
	Provider SessionProvider
}

SessionRegistration 会话方案的注册信息

type SessionRegistry added in v1.0.20

type SessionRegistry interface {
	Registration() *SessionRegistration
}

SessionRegistry 会话方案的注册接口

type SessionService added in v1.0.20

type SessionService interface {
	GetCurrent(c context.Context) (Session, error)
}

SessionService 是针对 SessionDTO 的服务

type Subject added in v1.0.20

type Subject interface {
	Init(ss SessionService)

	GetSession(create bool) Session

	HasRole(role rbac.RoleName) bool
}

Subject 代表当前主体

func GetSubject added in v1.0.20

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

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

Directories

Path Synopsis
gen
modules
src

Jump to

Keyboard shortcuts

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