middleware

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package middleware handles authentication, user permissions, and any other tasks that occur with an HTTP request to this app.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Administrator

func Administrator(next http.Handler) http.Handler

Administrator checks if the user has this permission.

func Auth

func Auth(next http.Handler) http.Handler

Auth is used to verify a request to this app is from a logged in and active user. If a user's credentials are found and valid, the user is redirected to the next HTTP handler, otherwise an error message is returned.

The Auth func should be called upon every page load or endpoint when a user is logged in.

This does not handle external API calls! External API calls are handled via a separate middleware since the authentication is done differently.

func CreateLicenses

func CreateLicenses(next http.Handler) http.Handler

CreateLicenses check if the user has this permission.

func ExternalAPI

func ExternalAPI(next http.Handler) http.Handler

ExternalAPI is used to verify a request to an publically accessible endpoint is being made with a valid API key. If the API key is valid, the request is redirected to the next HTTP handler, otherwise an error message is returned.

This func should be called upon every publically accessible endpoint.

func LogActivity2

func LogActivity2(next http.Handler) http.Handler

LogActivity2 saves the activity the user performed to the database.

This adds a lot of INSERTS to the database which may be undesirable based on server load. Therefore, you can disable this via app settings.

Skip on errors since logging isn't the most important thing in the world.

func SecHeaders

func SecHeaders(next http.Handler) http.Handler

SecHeaders sets http headers for security purposes.

func ViewLicenses

func ViewLicenses(next http.Handler) http.Handler

ViewLicenses check if the user has this permission.

Types

This section is empty.

Jump to

Keyboard shortcuts

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