auth

package
v0.0.0-...-aa5133b Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound  = errors.New("user not found")
	ErrWrongPasword  = errors.New("wrong password")
	ErrTokenNotFound = errors.New("token not found")
	ErrWrongToken    = errors.New("wrong token")
)

Functions

This section is empty.

Types

type AuthService

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

func (AuthService) Login

func (s AuthService) Login(req *LoginReq, res *string) error

func (AuthService) Logout

func (s AuthService) Logout(req *LogoutReq, _ *struct{}) error

func (AuthService) Signup

func (s AuthService) Signup(req *SignupReq, res *int64) error

func (AuthService) Validate

func (s AuthService) Validate(req *ValidateReq, _ *struct{}) error

type Client

type Client interface {
	Signup(username string, password string) (int64, error)
	Login(username string, password string) (string, error)
	Logout(username string, token string) error
	Validate(username string, token string) error
}

func NewClient

func NewClient(ctx context.Context, url string, name string) Client

type LoginReq

type LoginReq struct {
	Username string
	Password string
}

type LogoutReq

type LogoutReq struct {
	Username string
	Token    string
}

type Repository

type Repository interface {
	Create(username string, password string) (int64, error)
	Auth(username string, password string) (string, error)
	Deauth(username string, token string) error
	Validate(username string, token string) error
}

func NewSQLiteRepository

func NewSQLiteRepository(urn string) (Repository, error)

type Service

type Service interface {
	Signup(req *SignupReq, res *int64) error
	Login(req *LoginReq, res *string) error
	Logout(req *LogoutReq, res *struct{}) error
	Validate(req *ValidateReq, res *struct{}) error
}

func NewService

func NewService(r Repository) Service

type SignupReq

type SignupReq struct {
	Username string
	Password string
}

type ValidateReq

type ValidateReq struct {
	Username string
	Token    string
}

Jump to

Keyboard shortcuts

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