middleware

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JWTAuth

func JWTAuth(excludes ...string) core.MiddlewareHandler

JWTAuth an HTTP middleware that process login via JWT token.

Use:

app.Use(middleware.JWTAuth(
	prefixAPI+"/info",
	prefixAPI+"/auth/signin",
	prefixAPI+"/auth/refresh",
))

func SessionAuth

func SessionAuth(excludes ...string) core.MiddlewareHandler

SessionAuth an HTTP middleware that process login via Session/Cookie token for API or Page requests.

Use:

apiRouter.Use(middleware.SessionAuth(
	prefixAPI+"/frontend/auth/signin",
	"/dang-nhap",
))

func SessionAuthPage

func SessionAuthPage(c *core.Ctx) (err error)

SessionAuthPage an HTTP middleware that process login via Session/Cookie token.

Note:

  • SessionAuthPage and SessionManipulation are used together if you want to have a full manual control user's session for a specific Handler.

Use:

groupUsers.GET("/profile", f.Apply(middleware.SessionAuthPage)(user.NewAccountPage()))

func SessionManipulation

func SessionManipulation(c *core.Ctx) (err error)

SessionManipulation an HTTP middleware that tries to process Session.

Note:

  • Place first and before the webpage routers declarations
  • SessionAuthPage and SessionManipulation are used together if you want to have a full manual control user's session for a specific Handler.

Use:

webRouter.Use(middleware.SessionManipulation)

Types

This section is empty.

Jump to

Keyboard shortcuts

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