auth

package
v0.0.0-...-d4d2c18 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateJWT

func GenerateJWT(user User) (string, error)

func ParseJWT

func ParseJWT(tokenString string) (*jwt.Token, error)

func ValidatePassword

func ValidatePassword(user User, password string) error

Types

type Role

type Role struct {
	gorm.Model
	Name string
}

type User

type User struct {
	// gorm.Model
	ID       core.UUID `gorm:"primary_key;"`
	Username string    `gorm:"size:255;not null;unique" json:"username"`
	Password string    `gorm:"size:255;not null;" json:"-"`
}

func FindUserById

func FindUserById(id core.UUID) (User, error)

func FindUserByUsername

func FindUserByUsername(username string) (User, error)

func (*User) BeforeCreate

func (user *User) BeforeCreate(*gorm.DB) error

func (*User) BeforeSave

func (user *User) BeforeSave(*gorm.DB) error

func (*User) Save

func (user *User) Save() (*User, error)

Jump to

Keyboard shortcuts

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