utils

package
v0.0.0-...-8848315 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

provides main utility methods used across the server and the project

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRefreshCookie

func GenerateRefreshCookie(token string, expiry int64) *http.Cookie

set refresh token cookie

func GenerateToken

func GenerateToken(secret string, expiry int64, payload *map[string]string) (string, error)

generate new jwt token using given secret, expiry and claims payload

func GetTokenArguments

func GetTokenArguments(arguments []interface{}) (*map[string]string, http.ResponseWriter, error)

extract payload and responsewriter data from the interface array

func ValidateToken

func ValidateToken(tokenstring string, secret string) (*map[string]string, error)

Validate given JWT token. Returns claims payload on successful validation, else returns UnauthorizedError

Types

This section is empty.

Jump to

Keyboard shortcuts

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