authz

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthorizer

func NewAuthorizer(e *plcsvr.Enforcer) websvr.FilterFunc

NewAuthorizer returns the authorizer. Use a Bhojpur Policy enforcer as input

Types

type BasicAuthorizer

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

BasicAuthorizer stores the Bhojpur Policy handler

func (*BasicAuthorizer) CheckPermission

func (a *BasicAuthorizer) CheckPermission(r *http.Request) (bool, error)

CheckPermission checks the user/method/path combination from the request. Returns true (permission granted) or false (permission forbidden)

func (*BasicAuthorizer) GetUserName

func (a *BasicAuthorizer) GetUserName(r *http.Request) string

GetUserName gets the user name from the request. Currently, only HTTP basic authentication is supported

func (*BasicAuthorizer) RequirePermission

func (a *BasicAuthorizer) RequirePermission(w http.ResponseWriter)

RequirePermission returns the 403 Forbidden to the client

Jump to

Keyboard shortcuts

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