auth

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeAuthMiddleware

func MakeAuthMiddleware(repo db.DB, pubkey *rsa.PublicKey) gin.HandlerFunc

MakeAuthMiddleware creates a middleware that checks the incoming request for the token cookie If no token cookie is set or the token does not exist in the user DB, an access denied page is displayed to the user

func MakePermissionMiddleware

func MakePermissionMiddleware(permissions ...string) gin.HandlerFunc

MakePermissionMiddleware creates a middleware that will make sure that the incoming user has the given permissions before the request itself is handled. If the user does not have the correct permission, a HTTP 403 error is returned

func UserFromContext

func UserFromContext(c *gin.Context) *models.User

UserFromContext reads the HTTP request's user from the gin context

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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