Documentation
¶
Index ¶
- Variables
- type Authorizer
- func (Authorizer) CaddyModule() caddy.ModuleInfo
- func (a *Authorizer) CheckPermission(username string, r *http.Request) (bool, error)
- func (a *Authorizer) Provision(ctx caddy.Context) error
- func (a Authorizer) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
- func (a *Authorizer) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- func (a *Authorizer) Validate() error
Constants ¶
This section is empty.
Variables ¶
View Source
var CredentialValidator func(username, password string) bool
CredentialValidator validates a username and password from HTTP Basic Auth. Assign a custom implementation before using the plugin. If nil, any non-empty username is accepted without password verification.
Functions ¶
This section is empty.
Types ¶
type Authorizer ¶
type Authorizer struct {
AuthConfig struct {
ModelPath string `json:"model_path"`
PolicyPath string `json:"policy_path"`
} `json:"auth_config"`
Enforcer *casbin.Enforcer `json:"-"`
}
func (Authorizer) CaddyModule ¶
func (Authorizer) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*Authorizer) CheckPermission ¶
CheckPermission checks if the given user is allowed to access the resource.
func (*Authorizer) Provision ¶
func (a *Authorizer) Provision(ctx caddy.Context) error
Provision implements caddy.Provisioner.
func (Authorizer) ServeHTTP ¶
func (a Authorizer) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
ServeHTTP implements caddyhttp.MiddlewareHandler.
func (*Authorizer) UnmarshalCaddyfile ¶
func (a *Authorizer) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile implements caddyfile.Unmarshaler.
func (*Authorizer) Validate ¶
func (a *Authorizer) Validate() error
Validate implements caddy.Validator.
Click to show internal directories.
Click to hide internal directories.