Back to godoc.org
github.com/XiaoMi/naftis / src / api / middleware

Package middleware

v0.0.0-...-1927dbb
Latest Go to latest

The latest major version is .

Published: Jan 10, 2019 | License: Apache-2.0 | Module: github.com/XiaoMi/naftis

Index

Variables

var Auth = func() gin.HandlerFunc {
	return func(c *gin.Context) {
		u, e := util.Authentication(c.Request)
		if e != nil {
			c.AbortWithError(http.StatusUnauthorized, e)
			return
		}

		c.Set("user", u)
	}
}

Auth defines JWT authentication middleware.

var XSS = xssMw.RemoveXss

XSS defines Xss middleware.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier