auth

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Options
}

func New

func New(opts ...Option) *Auth

func (*Auth) Middleware

func (a *Auth) Middleware() web.MiddlewareFunc

type Option

type Option func(*Options)

func DB

func DB(db *pg.DB) Option

func Logger

func Logger(log logger.Logger) Option

type Options

type Options struct {
	DB     *pg.DB
	Logger logger.Logger
}

type User

type User struct {
	ID        string `sql:",pk"`
	Username  string
	Password  string
	CreatedAt time.Time
	UpdatedAt time.Time
}

func NewUser

func NewUser(db orm.DB, username, password string) (*User, error)

func (*User) ByName

func (u *User) ByName(db orm.DB, username string) error

func (*User) CheckPasswordHash

func (u *User) CheckPasswordHash(password string) (bool, error)

func (*User) HashPassword

func (u *User) HashPassword(password string) (string, error)

type UserRequest

type UserRequest struct {
	Username string `json:"username" form:"username"`
	Password string `json:"password" form:"password"`
}

Jump to

Keyboard shortcuts

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