Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfig ¶
func GetConfig(c *caddy.Controller) (string, string)
GetConfig gets the config path that corresponds to c.
func Setup ¶
func Setup(c *caddy.Controller) error
Setup parses the Casbin configuration and returns the middleware handler.
Types ¶
type Authorizer ¶
type Authorizer struct { Next httpserver.Handler Enforcer *casbin.Enforcer }
Authorizer is a middleware for filtering clients based on their ip or country's ISO code.
func (*Authorizer) CheckPermission ¶
func (a *Authorizer) CheckPermission(r *http.Request) bool
CheckPermission checks the user/method/path combination from the request. Returns true (permission granted) or false (permission forbidden)
func (*Authorizer) GetUserName ¶
func (a *Authorizer) GetUserName(r *http.Request) string
GetUserName gets the user name from the request. Currently, only HTTP basic authentication is supported
func (Authorizer) ServeHTTP ¶
func (a Authorizer) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)
ServeHTTP serves the request.
Click to show internal directories.
Click to hide internal directories.