authz

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 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.

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() func(next http.Handler) http.Handler

func (Authorizer) RequireAuthenticatedUser added in v0.11.0

func (a Authorizer) RequireAuthenticatedUser() func(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

Jump to

Keyboard shortcuts

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