utils

package
v0.0.0-...-590dba6 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

CheckPasswordHash compare 2 hash are same

func HashPassword

func HashPassword(password string) (string, error)

HashPassword create hash of string

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	jwt.StandardClaims
}

Claims Custome object

type JWToken

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

JWToken object of service

func NewJWToken

func NewJWToken(expirationDuration time.Duration, secretKey string) *JWToken

NewJWToken Create new service object

func (*JWToken) CreateToken

func (jw *JWToken) CreateToken(username string) (string, error)

CreateToken genrate new toekn for spacfic user

func (*JWToken) GetClaims

func (jw *JWToken) GetClaims(tokenStr string) (*Claims, error)

GetClaims return all claims

Jump to

Keyboard shortcuts

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