access

package
v0.0.0-...-3a9fb76 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: AGPL-3.0 Imports: 6 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 *model.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