middleware

package
v0.0.0-...-3c7337f Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthroizationToken

func GetAuthroizationToken(c *fiber.Ctx) *string

Types

type AuthMiddlewareInterface

type AuthMiddlewareInterface interface {
	ClubAuthorizeById(c *fiber.Ctx) error
	UserAuthorizeById(c *fiber.Ctx) error
	Authenticate(c *fiber.Ctx) error
	Authorize(requiredPermissions ...auth.Permission) func(c *fiber.Ctx) error
	Skip(h fiber.Handler) fiber.Handler
	IsSuper(c *fiber.Ctx) bool
	Limiter(rate int, duration time.Duration) func(c *fiber.Ctx) error
}

type AuthMiddlewareService

type AuthMiddlewareService struct {
	DB           *gorm.DB
	Validate     *validator.Validate
	AuthSettings config.AuthSettings
}

func NewAuthAuthMiddlewareService

func NewAuthAuthMiddlewareService(db *gorm.DB, validate *validator.Validate, authSettings config.AuthSettings) *AuthMiddlewareService

func (*AuthMiddlewareService) Authenticate

func (m *AuthMiddlewareService) Authenticate(c *fiber.Ctx) error

func (*AuthMiddlewareService) Authorize

func (m *AuthMiddlewareService) Authorize(requiredPermissions ...auth.Permission) func(c *fiber.Ctx) error

func (*AuthMiddlewareService) ClubAuthorizeById

func (m *AuthMiddlewareService) ClubAuthorizeById(c *fiber.Ctx) error

Authorizes admins of the specific club to make this request, skips check if super user

func (*AuthMiddlewareService) IsSuper

func (m *AuthMiddlewareService) IsSuper(c *fiber.Ctx) bool

func (*AuthMiddlewareService) Limiter

func (m *AuthMiddlewareService) Limiter(rate int, expiration time.Duration) func(c *fiber.Ctx) error

TODO: implement rate limiting with redis

func (*AuthMiddlewareService) UserAuthorizeById

func (m *AuthMiddlewareService) UserAuthorizeById(c *fiber.Ctx) error

Jump to

Keyboard shortcuts

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