middleware

package
v0.0.0-...-8ad1ab3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthMiddleware

type AuthMiddleware struct {
	// contains filtered or unexported fields
}

Middleware that checks if the requests contains a valid (not expired, not recalled) session token. Session token is expected to be in the Authorization HTTP header. Expected HTTP authorization scheme is "Bearer". Token is expected to be in the following format: {{.TokenId}}:{{.TokenSecret}} If the token is valid, database.User object of the token owner is inserted into the context under "user" key and the request is passed to the next handler. If the token is not valid, the middleware returns 401 Unauthorized and the request is not passed to the next handler.

func CreateAuthMiddleware

func CreateAuthMiddleware(logger *log.Logger, tokenService services.TokenService) *AuthMiddleware

func (*AuthMiddleware) Handle

func (middleware *AuthMiddleware) Handle(c *gin.Context)

Gin handler function for the middleware

type RequireValidEmailMiddleware

type RequireValidEmailMiddleware struct {
	// contains filtered or unexported fields
}

func CreateRequireValidEmailMiddleware

func CreateRequireValidEmailMiddleware(logger *log.Logger) *RequireValidEmailMiddleware

func (*RequireValidEmailMiddleware) Handle

func (middleware *RequireValidEmailMiddleware) Handle(c *gin.Context)

Jump to

Keyboard shortcuts

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