domain

package
v0.0.0-...-cbeb5a3 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JwtManager

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

func NewJWTManager

func NewJWTManager(secretKey string, tokenDuration time.Duration) *JwtManager

func (*JwtManager) Generate

func (m *JwtManager) Generate(u *User) (string, error)

func (*JwtManager) Verify

func (m *JwtManager) Verify(accessToken string) (*UserClaims, error)

type User

type User struct {
	Id          uint      `json:"id"`
	Name        string    `json:"name"`
	FamilyName  string    `json:"family_name"`
	Password    string    `json:"-"`
	Email       string    `json:"email"`
	Username    string    `json:"username"`
	IsActivated bool      `json:"is_activated"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	DeletedAt   time.Time `json:"-"`
}

func CreateNewUser

func CreateNewUser(name string, familyName string, email string, password string, username string) (*User, error)

func (*User) CheckPassword

func (u *User) CheckPassword(password string) bool

func (*User) SetPassword

func (u *User) SetPassword(password string) error

type UserClaims

type UserClaims struct {
	jwt.StandardClaims
	Id uint `json:"id"`
}

type UserService

type UserService interface {
	SignUp(name string, familyName string, email string, password string, username string, nationalId uint) (bool, error)
	Login(username string, password string) (string, *User, error)
	List() ([]User, error)
	UpdatePassword() (bool, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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