auth

package
v0.0.0-...-f2baea1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JWT_REFRESH_TOKEN = "YYELq6utge8Z9C8ynHawaHqcRpV6z33QT2mgfNdhL7porH4VPH3t3ppDSdprpzrMGNSKsmEK4aoFaarNmPByWFytEdLjBsLv"
View Source
var JWT_TOKEN_SECRET = "ZHTU3oHo6XButkt89ZkJRVUKcWPXDzbLU5UaGA3xYPpY6ASB873GXRJgXQp3pWTATNbNHtufS22xdLYrKf4NqCy5nNaKRryd"

Functions

func CreateUser

func CreateUser(ar UserRequest) (model.User, string)

func GetUser

func GetUser(ar UserNameRequest) (*model.User, string)

Types

type AuthRequest

type AuthRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type CustomClaim

type CustomClaim struct {
	Email string `json:"email"`
	jwt.StandardClaims
}

type TokenRequest

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

type TokenResponse

type TokenResponse struct {
	Status       bool   `json:"status"`
	Token        string `json:"token"`
	RefreshToken string `json:"refresh_token"`
}

func RefreshToken

func RefreshToken(tr string) (TokenResponse, string)

func ValidateUser

func ValidateUser(ar AuthRequest) (TokenResponse, string)

type UserNameRequest

type UserNameRequest struct {
	UserName string `json:"username"`
}

type UserRequest

type UserRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	FullName string `json:"full_name"`
	Name     string `json:"name"`
	LastName string `json:"last_name"`
	Nickname string `json:"nickname"`
	IdCard   string `json:"id_card"`
}

type ValidationResponse

type ValidationResponse struct {
	Status  bool   `json:"status"`
	Message string `json:"message"`
}

func ValidateToken

func ValidateToken(tr string) (ValidationResponse, string)

Jump to

Keyboard shortcuts

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