Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authorizer ¶
func Authorizer(e casbin.IEnforcer, opts ...Option) gin.HandlerFunc
Authorizer returns the authorizer uses a Casbin enforcer, and Subject as subject.
func ContextWithSubject ¶
ContextWithSubject return a copy of parent in which the value associated with subjectCtxKey is subject.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config for Authorizer
type Option ¶
type Option func(*Config)
Option config option
func WithErrorFallback ¶
WithErrorFallback set the fallback handler when request are error happened. default: the 500 server error to the client
func WithForbiddenFallback ¶
WithForbiddenFallback set the fallback handler when request are not allow. default: the 403 Forbidden to the client
func WithSkipAuthentication ¶
WithSkipAuthentication set the skip approve when it is return true. Default: always false
Click to show internal directories.
Click to hide internal directories.