helpers

package
v0.0.0-...-85ecf22 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateHash

func CalculateHash(password string) string

CalculateHash returns hashed string based on password

func CheckPasswordHash

func CheckPasswordHash(passwordHash, passwordClear string) bool

CheckPasswordHash returns true if hashed password is OK

func Decode

func Decode(rq *http.Request, data interface{}) error

Decode decodes JSON from body of Request

func DumpLink(link *models.Link)

DumpLink outputs all fields to console

func GetUID

func GetUID() string

GetUID returns UID

Types

type AuthHelper

type AuthHelper struct{}

AuthHelper used to access it as class

func NewAuthHelper

func NewAuthHelper() *AuthHelper

NewAuthHelper returns instance of helper

func (*AuthHelper) Decode

func (ah *AuthHelper) Decode(jwtToken string) (map[string]string, error)

Decode decodes JWT w/o validation

func (*AuthHelper) GenerateJwt

func (ah *AuthHelper) GenerateJwt(user *models.User, expirationInMin int) (string, error)

GenerateJwt returns encoded JWT string

func (*AuthHelper) ValidateHeader

func (ah *AuthHelper) ValidateHeader(header string) (*models.User, error)

ValidateHeader returns error in case HTTP header does not contain valid JWT

Jump to

Keyboard shortcuts

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