auth

package
v0.0.0-...-1d8daf6 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: MIT Imports: 15 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 will check hashed password against password

func CreateToken

func CreateToken(user *users.User) (*users.LoginResponse, error)

CreateToken will create access and refresh token

func DeleteToken

func DeleteToken(token string, isAccessToken bool) error

DeleteToken delete user token

func ExtractSessionUser

func ExtractSessionUser(token string) (*users.User, error)

func ExtractToken

func ExtractToken(ctx context.Context) (string, error)

ExtractToken try to extract token from context

func ExtractUser

func ExtractUser(ctx context.Context) (*users.User, error)

ExtractUser try to extract the current user from the context

func HashPassword

func HashPassword(password string) (string, error)

HashPassword return hashed password

func LoadTokens

func LoadTokens(token string) (*sessionData, error)

LoadTokens get tokens by access token

func SaveTokens

func SaveTokens(user *users.User, response *users.LoginResponse) error

SaveTokens save user tokens after login

func VerifyToken

func VerifyToken(req string) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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