certify

package
v0.0.0-...-c18a219 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidToken      = errors.New("security: invalid principal or credential")
	ErrInvalidPrincipal  = errors.New("security: principal is invalid")
	ErrInvalidCredential = errors.New("security: credential is invalid")
	ErrAccountLocked     = errors.New("security: account is locked")
	ErrAccountDisabled   = errors.New("security: account is disabled")
)

Functions

This section is empty.

Types

type Authenticator

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

func (*Authenticator) AddRealm

func (a *Authenticator) AddRealm(r ...Realm)

func (*Authenticator) Login

func (a *Authenticator) Login(token Token) (realm string, user security.User, err error)

type Realm

type Realm interface {
	// Name is the name of realm.
	Name() string
	// Login does authentication with token, it returns an error if failed, or nil user if skipped.
	Login(token Token) (security.User, error)
}

func NewSimpleRealm

func NewSimpleRealm(name string, login func(token *SimpleToken) (security.User, error)) Realm

type SimpleToken

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

func (*SimpleToken) Captcha

func (t *SimpleToken) Captcha() string

func (*SimpleToken) Credential

func (t *SimpleToken) Credential() interface{}

func (*SimpleToken) Name

func (t *SimpleToken) Name() string

func (*SimpleToken) Password

func (t *SimpleToken) Password() string

func (*SimpleToken) Principal

func (t *SimpleToken) Principal() interface{}

type Token

type Token interface {
	Principal() interface{}
	Credential() interface{}
}

func NewSimpleToken

func NewSimpleToken(name, pwd string, captcha ...string) Token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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