middleware

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

func InitializeAuthenticationMiddleware

func InitializeAuthenticationMiddleware(app *configs.Config)

Types

type Auth

type Auth struct {
	Issuer       string
	Audience     string
	Secret       string
	TokenExpiry  time.Duration
	CookieDomain string
	CookiePath   string
	CookieName   string
}
var AdminAuth *Auth

func (*Auth) AuthRequest

func (j *Auth) AuthRequest() gin.HandlerFunc

func (*Auth) GenerateTokenPair

func (j *Auth) GenerateTokenPair(user *JwtUser) (TokenPairs, error)

func (*Auth) GetTokenFromHeaderAndVerify

func (j *Auth) GetTokenFromHeaderAndVerify(c *gin.Context) (string, jwt.MapClaims, error)

type JwtUser

type JwtUser struct {
	ID    int    `json:"id"`
	Email string `json:"email"`
}

type TokenPairs

type TokenPairs struct {
	Token string `json:"access_token"`
}

Jump to

Keyboard shortcuts

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