password

package
v0.0.0-...-2a11bd6 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package password contains the service that handles passwords

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 *gorm.DB, rbac RBAC, sec Securer) *Password

Initialize initalizes password application service with defaults

func New

func New(db *gorm.DB, udb UserDBClientInterface, rbac RBAC, sec Securer) *Password

New creates new password application service

func (*Password) Change

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

Change changes user's password

type RBAC

type RBAC interface {
	EnforceUser(echo.Context, uint) 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, uint, string, string) error
}

Service represents password application interface

type UserDBClientInterface

type UserDBClientInterface interface {
	View(*gorm.DB, uint) (*models.User, error)
	Update(*gorm.DB, *models.User) error
}

UserDBClientInterface represents user repository interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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