authz

package
v0.37.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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. Also note that when auth is disabled this check also fails

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

type Authorizer added in v0.11.0

type Authorizer struct {
	// contains filtered or unexported fields
}

func NewAuthorizer added in v0.11.0

func NewAuthorizer(logger logrus.FieldLogger, httpUtils httputils.Utils) Authorizer

func (Authorizer) Require added in v0.11.0

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

func (Authorizer) RequireAdminRole added in v0.11.0

func (a Authorizer) RequireAdminRole(next http.Handler) http.Handler

func (Authorizer) RequireAuthenticatedUser added in v0.11.0

func (a Authorizer) RequireAuthenticatedUser(next http.Handler) http.Handler

func (Authorizer) RequireOneOf added in v0.11.1

func (a Authorizer) RequireOneOf(funcs ...func(r *http.Request) bool) func(next http.Handler) http.Handler

func (Authorizer) RequireRole added in v0.34.0

func (a Authorizer) RequireRole(role model.Role) func(next http.Handler) http.Handler

Jump to

Keyboard shortcuts

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