Documentation ¶
Index ¶
- Constants
- Variables
- func Client(opts ...Option) middleware.Middleware
- func SecurityUserFromContext(ctx context.Context) (authn.SecurityUser, bool)
- func Server(opts ...Option) middleware.Middleware
- type Option
- func WithAutoLoadPolicy(auto bool, per time.Duration) Option
- func WithCasbinEnforcer(enforcer stdcasbin.IEnforcer) Option
- func WithCasbinModel(model model.Model) Option
- func WithCasbinPolicy(policy persist.Adapter) Option
- func WithDomainSupport() Option
- func WithSecurityUserCreator(securityUserCreator authn.SecurityUserCreator) Option
- func WithWatcher(watcher persist.Watcher) Option
Constants ¶
View Source
const ( ModelContextKey contextKey = "CasbinModel" PolicyContextKey contextKey = "CasbinPolicy" EnforcerContextKey contextKey = "CasbinEnforcer" SecurityUserContextKey contextKey = "CasbinSecurityUser" )
Variables ¶
Functions ¶
func Client ¶
func Client(opts ...Option) middleware.Middleware
func SecurityUserFromContext ¶
func SecurityUserFromContext(ctx context.Context) (authn.SecurityUser, bool)
SecurityUserFromContext extract SecurityUser from context
func Server ¶
func Server(opts ...Option) middleware.Middleware
Types ¶
type Option ¶
type Option func(*options)
func WithAutoLoadPolicy ¶
WithAutoLoadPolicy enable policy auto load option
func WithCasbinEnforcer ¶
func WithCasbinModel ¶
func WithCasbinPolicy ¶
func WithSecurityUserCreator ¶
func WithSecurityUserCreator(securityUserCreator authn.SecurityUserCreator) Option
func WithWatcher ¶
WithWatcher Set Watcher for Casbin
Click to show internal directories.
Click to hide internal directories.