auth

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthFailure          = errors.New("auth: Authentication failure")
	ErrAuthProviderNotFound = errors.New("auth: Authentication provider not found")
)
View Source
var Default = "default"

Functions

func AuthInit

func AuthInit(auth string)

func Register

func Register(name string, provider Authenticator)

服务启动前注册有的鉴权插件

func Unregister

func Unregister(name string)

Types

type Authenticator

type Authenticator interface {
	Authenticate(id string, cred interface{}) error
}

func NewDefaultAuth

func NewDefaultAuth() Authenticator

func NewMysqlAuth

func NewMysqlAuth() Authenticator

func NewRedisAuth

func NewRedisAuth() Authenticator

type Manager

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

鉴权管理器,无需枷锁,保持无状态就行

func NewManager

func NewManager(providerName string) (*Manager, error)

func (*Manager) Authenticate

func (this *Manager) Authenticate(id string, cred interface{}) error

Jump to

Keyboard shortcuts

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