dbauth

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderName = "dbauth"

Functions

This section is empty.

Types

type Dependencies

type Dependencies struct {
	Db                    GormReadWrite
	Log                   Logger
	Secret                string
	ReloadUserRecordsFunc func() []UserRecord
	GenerateAuthHashFunc  func(user UserRecord) string
}

type GormReadWrite

type GormReadWrite interface {
	Read() *gorm.DB
	Write() *gorm.DB
}

type Logger

type Logger interface {
	InfoF(category string, message string, args ...interface{})
}

type Provider

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

func New

func New(dependencies Dependencies) (*Provider, error)

func (*Provider) GetProviderName

func (a *Provider) GetProviderName() string

func (*Provider) GetUniqueIdentifier

func (a *Provider) GetUniqueIdentifier(ctx *fasthttp.RequestCtx) string

func (*Provider) IsAuthenticated

func (a *Provider) IsAuthenticated(ctx *fasthttp.RequestCtx) bool

func (*Provider) Login

func (a *Provider) Login(ctx *fasthttp.RequestCtx) (bool, map[string]error)

func (*Provider) Logout

func (a *Provider) Logout(ctx *fasthttp.RequestCtx) bool

func (*Provider) Register

func (a *Provider) Register(ctx *fasthttp.RequestCtx) (bool, map[string]error)

func (*Provider) SetAuthCookie

func (a *Provider) SetAuthCookie(ctx *fasthttp.RequestCtx, user UserRecord) error

type UserClaim

type UserClaim struct {
	Email    string `json:"email"`
	AuthHash string `json:"auth_hash"`
	jwt.StandardClaims
}

type UserRecord

type UserRecord interface {
	GetEmail() string
	GetPassword() string
	GetCreated() time.Time
}

Jump to

Keyboard shortcuts

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