password

package
v0.0.0-...-c60e208 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncorrectPassword = echo.NewHTTPError(http.StatusBadRequest, "incorrect old password")
	ErrInsecurePassword  = echo.NewHTTPError(http.StatusBadRequest, "insecure password")
)

Custom errors

Functions

This section is empty.

Types

type Password

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

Password represents password application service

func Initialize

func Initialize(db *pg.DB, rbac RBAC, sec Securer) *Password

Initialize initalizes password application service with defaults

func New

func New(db *pg.DB, udb UserDB, rbac RBAC, sec Securer) *Password

New creates new password application service

func (*Password) Change

func (p *Password) Change(c echo.Context, userID int, oldPass, newPass string) error

Change changes user's password

type RBAC

type RBAC interface {
	EnforceUser(echo.Context, int) error
}

RBAC represents role-based-access-control interface

type Securer

type Securer interface {
	Hash(string) string
	HashMatchesPassword(string, string) bool
	Password(string, ...string) bool
}

Securer represents security interface

type Service

type Service interface {
	Change(echo.Context, int, string, string) error
}

Service represents password application interface

type UserDB

type UserDB interface {
	View(orm.DB, int) (*model.User, error)
	Update(orm.DB, *model.User) error
}

UserDB represents user repository interface

Directories

Path Synopsis
platform

Jump to

Keyboard shortcuts

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