mw

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(r *echo.Echo, m ...echo.MiddlewareFunc)

Add adds middlewares to gin engine

func CORS

func CORS() echo.MiddlewareFunc

CORS adds Cross-Origin Resource Sharing support

func SecureHeaders

func SecureHeaders() echo.MiddlewareFunc

SecureHeaders adds general security headers for basic security measures

Types

type JWT

type JWT struct {
	// Realm name to display to the user.
	Realm string

	// Secret key used for signing.
	Key []byte

	// Duration for which the jwt token is valid.
	Duration time.Duration

	// JWT signing algorithm
	Algo string
}

JWT provides a Json-Web-Token authentication implementation

func NewJWT

func NewJWT(c *config.JWT) *JWT

NewJWT generates new JWT variable necessery for auth middleware

func (*JWT) GenerateToken

func (j *JWT) GenerateToken(u *model.User) (string, string, error)

GenerateToken generates new JWT token and populates it with user data

func (*JWT) MWFunc

func (j *JWT) MWFunc() echo.MiddlewareFunc

MWFunc makes JWT implement the Middleware interface.

func (*JWT) ParseToken

func (j *JWT) ParseToken(c echo.Context) (*jwt.Token, error)

ParseToken parses token from Authorization header

Jump to

Keyboard shortcuts

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