middleware

package
v0.0.0-...-1518e3e Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

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

This file tracks user activity within the app. It saves a record of every page viewed or endpoint visited so we can investigate user activity as needed.

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

This file checks if a user is already authenticated to the app (has a session set), that the user and session are valid, that the user is active, and that the user's password hasn't changed.

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

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

This file handles external api access to this app using an API key.

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

This file defines functions for checking user permissions. A function must be created for each permission to be checked (see users table schema).

Try to keep the funcs in the same order as the permissions in the gui and as defined in the user struct. Just easier to lookup and find.

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

This file sets headers for security purposes to protect against cross site scripts, clickjacking, etc.

The SecHeaders func should be called upon every page load.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Administrator

func Administrator(next http.Handler) http.Handler

Administrator check 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 authenticated via a user profile. API authentications are handled via middleware.ExternalAPI since api reachable endpoints are hosted on /api/v1/. If a user is found then the next middleware or handler is performed, otherwise a user is redirected to a login page.

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 handles authenticating access to the public endpoints using api keys.

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