authentication

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUserMiddleware

func AddUserMiddleware(f func(*http.Request) User) mux.Middleware

Add a user to the request.

Types

type User

type User interface {
	// Check if the user is authenticated
	IsAuthenticated() bool

	// Check if the user is an administator
	IsAdmin() bool
}

Default request user interface.

This interface can be used to check if the user is authenticated and if the user is an administrator.

If you want to use these middlewares, you should implement this interface.

func Retrieve

func Retrieve(r *http.Request) User

Helper function to get the user from the request.

Jump to

Keyboard shortcuts

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