authz

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RequireAdminRole         = Require(Role(model.AdminRole))
	RequireAuthenticatedUser = Require(AuthenticatedUser)
)

Functions

func AllowAny

func AllowAny(next http.Handler) http.Handler

AllowAny does not verify if a request is authorized.

func AuthenticatedUser

func AuthenticatedUser(r *http.Request) bool

AuthenticatedUser authorizes any authenticated user.

Note that authenticated API key is not linked to any user, therefore this check will fail.

func Require

func Require(funcs ...func(r *http.Request) bool) func(next http.Handler) http.Handler

func Role

func Role(role model.Role) func(r *http.Request) bool

Role verifies if the identity (user or API key) associated with the request has the given role.

Types

This section is empty.

Jump to

Keyboard shortcuts

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