authn

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, user IdentityUser) context.Context

NewContext 创建验证上下文

Types

type Config

type Config struct {
	Authentication map[string][]string
}

Config 登錄驗證設定

func (*Config) IsIdentityUser

func (c *Config) IsIdentityUser(user *IdentityUser, route string) bool

IsIdentityUser 验证是否通过

type Handler

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

Handler 函數調用跟蹤器

var (

	//DefaultHandler 默認AOP攔截器
	DefaultHandler *Handler
)

func NewHandler

func NewHandler(c *Config) *Handler

NewHandler 创建Handler

func (*Handler) After

func (h *Handler) After(ctx *aop.Context)

After 執行後

func (*Handler) Before

func (h *Handler) Before(ctx *aop.Context) error

Before 執行前

type IdentityUser

type IdentityUser struct {
	//ID 驗證帳號
	ID string
	//Name 驗證名稱
	Name string
}

IdentityUser 驗證用戶信息

func FromContext

func FromContext(ctx context.Context) *IdentityUser

FromContext 从context中提取登录用户

Jump to

Keyboard shortcuts

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