auth

package
v0.0.0-...-cea2a50 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const AuthKey = "authUser"

Variables

This section is empty.

Functions

func MakeToken

func MakeToken(nick string, password string) string

Types

type AuthUser

type AuthUser struct {
	Nick  string
	Token string
}

func (*AuthUser) String

func (a *AuthUser) String() string

type LoginUser

type LoginUser struct {
	Nick     string `json:"nick"`
	Password string `json:"password"`
}

LoginUser is for logging

func (*LoginUser) String

func (a *LoginUser) String() string

type Repository

type Repository interface {
	LoginUser(LoginUser) (string, error)
	SigninUser(SigninUser) (string, error)
	ReadAuthUsers() []AuthUser
}

Repository for auth

type Response

type Response struct {
	Token string `json:"token"`
}

Response return token

type Service

type Service interface {
	LoginUser(LoginUser) (Response, error)
	SigninUser(SigninUser) (Response, error)
	ReadAuthUsers() []AuthUser
}

Service for auth

func NewService

func NewService(r Repository) Service

NewService will return Service

type SigninUser

type SigninUser struct {
	Nick       string  `json:"nick"`
	Name       *string `json:"name"`
	SecondName *string `json:"second_name"`
	Email      *string `json:"email"`
	Password   string  `json:"password"`
}

SigninUser is for signin

func (*SigninUser) String

func (a *SigninUser) String() string

Jump to

Keyboard shortcuts

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