middleware

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CSRFKey               = []byte(viper.GetString("http.csrfKey"))    // 32-byte Key
	JWTSigningKey         = []byte(viper.GetString("http.signingKey")) // 32-byte Key
	BearerTokenCookieName = "access-token"
)

Functions

func GenerateToken

func GenerateToken(user *User, c echo.Context) error

GenerateToken generates a new bearer token for the user

func InteractionMiddleware

func InteractionMiddleware(config InteractionConfig) echo.MiddlewareFunc

InteractionMiddleware captures interactions with the server

func JWTAPIError

func JWTAPIError(err error, c echo.Context) error

func JWTRedirectError

func JWTRedirectError(err error, c echo.Context) error

Types

type InteractionConfig

type InteractionConfig struct {
	Version    string
	Polling    *polling.PollingServer
	Skipper    middleware.Skipper
	Marshaller *encoding.Marshal
}

InteractionConfig configures the InteractionMiddleware

type JWTClaim

type JWTClaim struct {
	Name string `json:"name"`
	jwt.StandardClaims
}

JWTClaim is used to create a new JTW Claim

type User

type User struct {
	Password string `json:"password" form:"password"`
	Username string `json:"username" form:"username"`
}

User provides a struct for echo.Bind

func LoadAdminAccount

func LoadAdminAccount() *User

AdminUserAccount parses the credentials in the configuration

Jump to

Keyboard shortcuts

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