custommiddleware

package
v0.0.0-...-bddae19 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: Unlicense Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENV_SECRET string = "SECRET"
	NO_AUTH    string = "unauthorized access"
	ClaimsKey  string = "jwt_claims"
)
View Source
const (
	ErrAccessDenied string = "access denied"
)

Variables

View Source
var SecretKey []byte
View Source
var (
	// TrackingCtxKey is the context.Context key to store the tracking id for a request.
	TrackingCtxKey = &contextKey{"tracking_id"}
)

Functions

func Auth

func Auth(next http.Handler) http.Handler

Strict Auth, does not allow invalid tokens

func AuthDirective

func AuthDirective(ctx context.Context, obj interface{}, next graphql.Resolver) (interface{}, error)

func GenTrackingID

func GenTrackingID(next http.Handler) http.Handler

func GenerateToken

func GenerateToken(jwtPayload models.JWTPayload, customExpTimeInMinute int) (string, error)

func GetClaimsFromJWTTokenCtx

func GetClaimsFromJWTTokenCtx(ctx context.Context) (*models.Claims, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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