access

package
v0.0.0-...-61e3c9a Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidRegistrationConfig = errors.New("services: invalid registration configuration")

Functions

This section is empty.

Types

type AccessApplication

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

AccessApplication holds all services related to access management.

func NewAccessApplication

func NewAccessApplication(cfgs []AccessConfig) (*AccessApplication, error)

NewAccessApplication intitializes the access application.

func (*AccessApplication) CheckPasswordHash

func (a *AccessApplication) CheckPasswordHash(password, hash string) bool

CheckPasswordHash checks that the input password matches the hash.

func (*AccessApplication) HashPassword

func (a *AccessApplication) HashPassword(password string) (string, error)

HashPassword hashes a password from plain text.

func (*AccessApplication) RegisterUser

func (a *AccessApplication) RegisterUser(name, email, password string) (UserDTO, error)

RegisterUser registers a user if the email is not already registered.

type AccessConfig

type AccessConfig func(a *AccessApplication) error

AccessConfig is a function that modifies the application configuration.

func WithMemoryRepositories

func WithMemoryRepositories() AccessConfig

WithMemoryRepositories attaches in-memory repostories to application.

func WithPasswordHashCost

func WithPasswordHashCost(cost int) AccessConfig

WithPasswordHashCost attaches a password hash cost to application.

type UserDTO

type UserDTO struct {
	Entity core.Person
	Email  string
	Active bool
}

UserDTO is a data transfer object of a user.

func NewUserDTO

func NewUserDTO(user *user.User) UserDTO

NewUserDTO creates a user DTO.

Directories

Path Synopsis
domain
infrastructure

Jump to

Keyboard shortcuts

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