auth

package
v0.0.0-...-704c986 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNameExist = errors.New("The user name already exists!")
)

Functions

func AuthFunc

func AuthFunc(ctx context.Context) (context.Context, error)

Types

type AuthModule

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

func NewAuthModule

func NewAuthModule(addr string) (*AuthModule, error)

func (*AuthModule) CheckOrCreateUser

func (s *AuthModule) CheckOrCreateUser(userName string, password string) error

type User

type User struct {
	gorm.Model
	Username     string
	FullName     string
	PasswordHash []byte // bcrypt password
	IsDisabled   bool
}

type UserSession

type UserSession struct {
	gorm.Model
	SessionKey   string
	UserID       uint // int not null, -- Could have a hard "references User"
	LoginTime    time.Time
	LastSeenTime time.Time
}

Jump to

Keyboard shortcuts

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