auth

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Zlib Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SourceAt

func SourceAt(source string) string

func SourceKeyForClient

func SourceKeyForClient(source token.Source) string

func SourceKeyForServer

func SourceKeyForServer(source token.Source) string

Types

type Authenticate

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

func New

func New(secret SecretOBJ) *Authenticate

func (*Authenticate) Check

func (t *Authenticate) Check(source token.Source, tok string) (*token.Token, error)

Check implement token.Authenticate interface

func (*Authenticate) Generate

func (t *Authenticate) Generate(source token.Source, session token.Session, extend string, expire int64) (string, error)

Generate implement token.Authenticate interface

func (*Authenticate) IsEnabled

func (t *Authenticate) IsEnabled(source token.Source) bool

IsEnabled implement token.Authenticate interface

func (*Authenticate) SetEnabled

func (t *Authenticate) SetEnabled(source token.Source, enable bool)

SetEnabled implement token.Authenticate interface

type Item

type Item struct {
	Enabled bool          `json:"enabled"`
	Secret  secret.Secret `json:"secret"`
}

type SecretMgr

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

func NewMgr

func NewMgr(skFuncs SourceKeyFuncs) *SecretMgr

func (*SecretMgr) AddItem added in v0.5.0

func (mgr *SecretMgr) AddItem(source token.Source, item Item)

func (*SecretMgr) AddItemWithKey added in v0.5.0

func (mgr *SecretMgr) AddItemWithKey(key string, item Item)

func (*SecretMgr) AddSecret added in v0.5.0

func (mgr *SecretMgr) AddSecret(source token.Source, secret secret.Secret)

func (*SecretMgr) AddSecretWithKey added in v0.5.0

func (mgr *SecretMgr) AddSecretWithKey(key string, secret secret.Secret)

func (*SecretMgr) GetSecret

func (mgr *SecretMgr) GetSecret(source token.Source) secret.Secret

GetSecret implement SecretOBJ interface

func (*SecretMgr) IsEnabled

func (mgr *SecretMgr) IsEnabled(source token.Source) bool

IsEnabled implement SecretOBJ interface

func (*SecretMgr) Load added in v0.5.0

func (mgr *SecretMgr) Load(items map[string]Item) error

func (*SecretMgr) LoadFromFile added in v0.5.0

func (mgr *SecretMgr) LoadFromFile(file string) error

func (*SecretMgr) SetEnabled

func (mgr *SecretMgr) SetEnabled(source token.Source, enable bool)

SetEnabled implement SecretOBJ interface

type SecretOBJ added in v0.5.0

type SecretOBJ interface {
	GetSecret(source token.Source) secret.Secret
	SetEnabled(source token.Source, enable bool)
	IsEnabled(source token.Source) bool
}

type SourceKeyFuncs

type SourceKeyFuncs func(source token.Source) string

SourceKeyFuncs source to key function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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