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 ¶
ErrorHandler is the default error handler. Use it to change the behavior for each error.
func InitACConf ¶
InitACConf constructs a new global access control configuration.
func RequestSrc ¶
RequestSrc is access control middleware auth middleware must be configured before this middleware
Types ¶
type ACResponse ¶
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.