auth

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module(
	"auth",
	fx.Decorate(func(log *zap.Logger) *zap.Logger {
		return log.Named("auth")
	}),
	fx.Provide(New),
)

Functions

func WithDevice added in v1.10.0

func WithDevice(handler func(models.Device, *fiber.Ctx) error) fiber.Handler

func WithUser added in v1.10.0

func WithUser(handler func(models.User, *fiber.Ctx) error) fiber.Handler

Types

type Config

type Config struct {
	Mode         Mode
	PrivateToken string
}

type Mode

type Mode string
const (
	ModePublic  Mode = "public"
	ModePrivate Mode = "private"
)

type Params

type Params struct {
	fx.In

	Config Config

	Users      *repositories.UsersRepository
	DevicesSvc *devices.Service

	Logger *zap.Logger
}

type Service

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

func New

func New(params Params) *Service

func (*Service) AuthorizeDevice

func (s *Service) AuthorizeDevice(token string) (models.Device, error)

func (*Service) AuthorizeRegistration

func (s *Service) AuthorizeRegistration(token string) error

func (*Service) AuthorizeUser

func (s *Service) AuthorizeUser(username, password string) (models.User, error)

func (*Service) IsPublic

func (s *Service) IsPublic() bool

func (*Service) RegisterDevice

func (s *Service) RegisterDevice(user models.User, name, pushToken *string) (models.Device, error)

func (*Service) RegisterUser

func (s *Service) RegisterUser(login, password string) (models.User, error)

func (*Service) UpdateDevice

func (s *Service) UpdateDevice(id, pushToken string) error

Jump to

Keyboard shortcuts

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