utils

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2019 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func GenerateJWTToken

func GenerateJWTToken(email string, groupId uint8, tenantSchema string) (string, string)

Function will generate a unique JWT token with the claims data of holding the `userID` paramter.

func GetJSONFromMessagePackRequest

func GetJSONFromMessagePackRequest(r *http.Request) (string, error)

func GetJWTClaimsFromContext

func GetJWTClaimsFromContext(ctx context.Context) (string, string, uint8)

Function used to extract the `email` from the JWT token that was passed in by the JWT middleware when a successful authentication happened.

func GetJWTTokenAuthority

func GetJWTTokenAuthority() *jwtauth.JWTAuth

Function will either lazily create and return the JWT token authority object, or return the JWT token authority if it was previously created.

func HashPassword

func HashPassword(password string) (string, error)

func Message

func Message(status bool, message string) map[string]interface{}

func NewContextWithJWTToken

func NewContextWithJWTToken(token string) context.Context

Function used to create a new context with the JWT authenticated `claims` already attached to the context. This function should be used in unit tests.

func Respond

func Respond(w http.ResponseWriter, data map[string]interface{})

func VerifyToken

func VerifyToken(tokenStr string) (*jwt.Token, bool)

*

Types

This section is empty.

Jump to

Keyboard shortcuts

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