handlers

package
v0.0.0-...-6f8b084 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateJWTToken

func CreateJWTToken(user *repo.DataModel) string

CreateJWTToken a helper function for creating JWT token

func NewConfiguration

func NewConfiguration(manager *scs.SessionManager, repo *repo.DBRepo)

NewConfiguration use for creating a new configuration for our handlers

Types

type AppConf

type AppConf struct {
	ScsManager   *scs.SessionManager
	DRepo        *repo.DBRepo
	HashFunction func() hash.Hash
}
var Conf *AppConf

func (*AppConf) CheckStatusHandler

func (conf *AppConf) CheckStatusHandler(w http.ResponseWriter, r *http.Request)

CheckStatusHandler just for checking the API handlers

func (*AppConf) EnableCORS

func (conf *AppConf) EnableCORS(next http.Handler) http.Handler

EnableCORS use for enabling cors for the client

func (*AppConf) GetAndCheckHmacToken

func (conf *AppConf) GetAndCheckHmacToken(w http.ResponseWriter, r *http.Request)

GetAndCheckHmacToken use for getting and checking the HMAC token that we store it in cookies

func (*AppConf) LoadSession

func (conf *AppConf) LoadSession(next http.Handler) http.Handler

LoadSession use for loading and saving user session in client

func (*AppConf) ParseJWTToken

func (conf *AppConf) ParseJWTToken(w http.ResponseWriter, r *http.Request)

ParseJWTToken use for parsing JWT token with claims

func (*AppConf) SaveHmacToken

func (conf *AppConf) SaveHmacToken(w http.ResponseWriter, r *http.Request)

SaveHmacToken use for saving HMAC token based on sha hash functions for user

func (*AppConf) SaveJWTToken

func (conf *AppConf) SaveJWTToken(w http.ResponseWriter, r *http.Request)

SaveJWTToken use for store JWT token in scs.Session

func (*AppConf) SignWithHmac

func (conf *AppConf) SignWithHmac(userMail string, key string) (string, error)

SignWithHmac use for creating HMAC tokens

type Status

type Status struct {
	Ok      bool   `json:"ok"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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