auth

package
v0.0.0-...-e8464d3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: MIT Imports: 4 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 {
	// contains filtered or unexported fields
}

func NewAuth

func NewAuth(driver, dbConnect string, loginDelay time.Duration) (*Auth, error)

func (*Auth) Authenticator

func (d *Auth) Authenticator(username string, password string, c *gin.Context) (interface{}, bool)

func (*Auth) CreateUser

func (d *Auth) CreateUser(login string, passwordHash string) error

func (*Auth) DeleteUser

func (d *Auth) DeleteUser(id int) error

func (*Auth) GetUser

func (d *Auth) GetUser(login string, passwordHash string) (*UserAuth, bool)

func (*Auth) GetUserByLogin

func (d *Auth) GetUserByLogin(login string) (*User, error)

func (*Auth) ListUsers

func (d *Auth) ListUsers() ([]User, error)

func (*Auth) UpdateUser

func (d *Auth) UpdateUser(id int, passwordHash string) error

type User

type User struct {
	Id           int    `db:"id"`
	Login        string `db:"login"`
	PasswordHash string `db:"password_hash"`
}

type UserAuth

type UserAuth struct {
	UserId   int    `json:"user_id" db:"id"`
	UserRole string `json:"user_role" db:"-"`
}

Jump to

Keyboard shortcuts

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