user

package
v0.0.0-...-7d85c2f Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

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

Authenticator struct

func CreateUserAuthenticator

func CreateUserAuthenticator(userRepository repository.User, jwtCreator JwtCreator) *Authenticator

CreateUserAuthenticator Authenticator constructor

func (Authenticator) Auth

func (a Authenticator) Auth(email string, password string) (*domain.UserAuth, error)

Auth authenticates user

type Creator

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

Creator creates a user from request

func CreateUserCreator

func CreateUserCreator(userRepository repository.User) *Creator

CreateUserCreator Creator constructor

func (Creator) Create

func (c Creator) Create(request request.UserCreation) (*domain.User, error)

Create a user

type JwtCreator

type JwtCreator interface {
	Create(id int) (*domain.UserAuth, error)
}

JwtCreator interface

type JwtParser

type JwtParser interface {
	Parse(tokenString string) (int, error)
}

JwtParser interface

type JwtService

type JwtService struct {
	Secret    string
	TokenDays int
}

JwtService struct

func CreateJwtService

func CreateJwtService(secret string, tokenDays int) *JwtService

CreateJwtService JwtService constructor

func (JwtService) Create

func (j JwtService) Create(id int) (*domain.UserAuth, error)

Create returns token from user id

func (JwtService) Parse

func (j JwtService) Parse(tokenString string) (int, error)

Parse returns user id from token

Jump to

Keyboard shortcuts

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