authentication

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: GPL-2.0 Imports: 3 Imported by: 3

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