auth

package
v0.0.0-...-1f6e3fe Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AuthCookie is cookie name used in autentication api, maybe use a injected parameter instead
	AuthCookie string = "olivsoftauth"

	// LoggedUser contains the UUID for the current user inside context
	LoggedUser string = "current-logged-user"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	Login(ctx context.Context, username string, password string) (*User, error)
	Register(ctx context.Context, user *User) error
}

type SessionSigner

type SessionSigner interface {
	SignUser(identifier string) (string, error)
	Validate(token string) (string, error)
}

type User

type User struct {
	UUID      uuid.UUID      `gorm:"type:uuid;primaryKey" json:"uuid" binding:"-"`
	CreatedAt time.Time      `json:"createdAt" binding:"-"`
	UpdatedAt time.Time      `json:"updatedAt" binding:"-"`
	DeletedAt gorm.DeletedAt `json:"-" binding:"-"`
	FirstName string         `json:"firstName" binding:"required"`
	LastName  string         `json:"lastName"`
	Email     string         `json:"email" gorm:"UNIQUE" binding:"required"`
	Username  string         `json:"username" gorm:"UNIQUE" binding:"required"`
	Password  string         `json:"password"`
	Active    bool           `json:"active"  `
}

User domain/database representation

func (*User) BeforeCreate

func (u *User) BeforeCreate(scope *gorm.DB) (err error)

BeforeCreate execute commands before creating User

func (User) TableName

func (User) TableName() string

TableName set user table name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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