interactors

package
v0.0.0-...-a5345d3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotExists user not exists
	ErrNotExists = errors.New("User doesn't exist")
	// ErrWrongCredentials wrong credentials provided
	ErrWrongCredentials = errors.New("Wrong credentials")
	// ErrUnauthorized authorization failed
	ErrUnauthorized = errors.New("Not authorized")
	// ErrTokenExpired - token expired
	ErrTokenExpired = errors.New("Token expired")
	// ErrUserAlreadyExists user with the same name already exists
	ErrUserAlreadyExists = errors.New("User exists")
)

Functions

This section is empty.

Types

type UserInteractor

type UserInteractor interface {
	Authenticate(username, password, remoteAddr string) (*entities.User, *entities.Session, error)
	Authorize(string) (*entities.User, error)
	Create(*entities.User) error
}

UserInteractor combines different implementations to process external requests.

func NewUserInteractor

func NewUserInteractor(
	config config.AppConfig,
	userRepository implementation.UserRepository,
	sessionRepository implementation.SessionRepository,
) (UserInteractor, error)

NewUserInteractor constructs UserInteractor.

type UserInteractorImpl

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

UserInteractorImpl implements UserInteractor.

func (UserInteractorImpl) Authenticate

func (userInteractor UserInteractorImpl) Authenticate(username, password, remoteAddr string) (*entities.User, *entities.Session, error)

Authenticate generates access token.

func (UserInteractorImpl) Authorize

func (userInteractor UserInteractorImpl) Authorize(token string) (*entities.User, error)

Authorize checks if user authorized on system.

func (UserInteractorImpl) Create

func (userInteractor UserInteractorImpl) Create(user *entities.User) error

Create implements new user creation.

Jump to

Keyboard shortcuts

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