Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrResrouceMissing 未提供资源 ErrResrouceMissing = errors.New("required resource not found") // ErrAuthMissing no auth ErrAuthMissing = errors.New("api needs authentication, ask developer to add auth middleware for this api") // ErrNoPermission user don't have resource ErrNoPermission = errors.New("you don't have permission to access the api") )
Functions ¶
func ErrorHandler ¶ added in v0.3.3
ErrorHandler is the default error handler. Use it to change the behavior for each error.
func InitACConf ¶ added in v0.3.3
InitACConf constructs a new global access control configuration.
func RequestSrc ¶ added in v0.3.3
RequestSrc is access control middleware auth middleware must be configured before this middleware
Types ¶
type ACResponse ¶ added in v0.3.3
type ACResponse struct {
HasPerm bool `json:"has_perm"`
}
ACResponse is access control response when reqeust ac service
type Config ¶
type Config struct { // AccessControlService is access control service address:port AccessControlService string // APIPath APIPath string // ServiceName is the service name, used for app_name ServiceName string // SkipAccessContorl, true: skip the access control; false: check user's resource SkipAccessContorl bool }
Config is a struct for specifying configuration options for the accesscontrol middleware.
var AccessControllConf Config
AccessControllConf is accesscontrol middleware configuration.
Click to show internal directories.
Click to hide internal directories.