Documentation
¶
Index ¶
- type ActionType
- type Middleware
- func (Middleware) CaddyModule() caddy.ModuleInfo
- func (m *Middleware) Provision(ctx caddy.Context) error
- func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
- func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- func (m *Middleware) Validate() error
- type Permission
- type RoleDefinition
- type RoleDefinitions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
ActionType represents an action that can be either a single string or a slice of strings
type Middleware ¶
type Middleware struct {
Role string `json:"role,omitempty"`
RolesFilePath string `json:"roles_file,omitempty"`
// contains filtered or unexported fields
}
Middleware implements an HTTP handler that writes the visitor's IP address to a file or stream.
func (Middleware) CaddyModule ¶
func (Middleware) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*Middleware) Provision ¶
func (m *Middleware) Provision(ctx caddy.Context) error
Provision implements caddy.Provisioner.
func (Middleware) ServeHTTP ¶
func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
ServeHTTP implements caddyhttp.MiddlewareHandler.
func (*Middleware) UnmarshalCaddyfile ¶
func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile implements caddyfile.Unmarshaler.
func (*Middleware) Validate ¶
func (m *Middleware) Validate() error
Validate implements caddy.Validator.
type Permission ¶
type Permission struct {
Type string `json:"type,omitempty"` // "allow" (default) or "deny"
Action ActionType `json:"action"` // string or []string
Resource string `json:"resource"` // resource pattern
}
Permission represents a single permission rule
type RoleDefinition ¶
type RoleDefinition []Permission
RoleDefinition represents a list of permissions for a role
type RoleDefinitions ¶
type RoleDefinitions map[string]RoleDefinition
RoleDefinitions represents the mapping of role names to their permissions
func (*RoleDefinitions) UnmarshalJSON ¶
func (rd *RoleDefinitions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler for RoleDefinitions