auth

package
v0.0.0-...-dfd90ba Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WrongPasswordOrLoginError = errors.New("wrong password or login")
)

Functions

This section is empty.

Types

type RegisterParams

type RegisterParams struct {
	Username string
	Email    string
	Name     string
	Password string
}

type Repository

type Repository interface {
	Authenticate(email, password string) (models.User, error)
	SetSession(id string, session *models.Session, expiration time.Duration) error
	CheckAuth(userId, sessionId string) (models.User, error)
	Register(user *models.User) error
	DeleteSession(userId, sessionId string) error
}

type Service

type Service interface {
	Authenticate(login, hashedPassword string) (models.User, SessionParams, error)
	Register(user *RegisterParams) (models.User, SessionParams, error)
	SetSession(id string, session *models.Session, expiration time.Duration) error
	CheckAuth(userId, sessionId string) (models.User, error)
	DeleteSession(userId, sessionId string) error
	CreateSession(userId int) SessionParams
}

type SessionParams

type SessionParams struct {
	Token      string
	LivingTime time.Duration
}

Directories

Path Synopsis
delivery
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
repository

Jump to

Keyboard shortcuts

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