Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MiddlewareBuilder ¶
type MiddlewareBuilder struct {
// contains filtered or unexported fields
}
MiddlewareBuilder is a struct that assembles middleware components by using the Casbin library for authorization and a file system watcher for policy changes.
func InitMiddlewareBuilder ¶ added in v0.0.20
func InitMiddlewareBuilder(modelFile, policyFile string, subResolver SubResolver) (*MiddlewareBuilder, error)
InitMiddlewareBuilder is a constructor function for MiddlewareBuilder. It initializes the Casbin enforcer, file system watcher, and sets up the policy file watching. It returns a pointer to the created MiddlewareBuilder and any error encountered during the initialization process.
func (*MiddlewareBuilder) Build ¶
func (b *MiddlewareBuilder) Build() mist.Middleware
Build is a method that constructs the middleware used to check permissions on each request.
func (*MiddlewareBuilder) Close ¶
func (b *MiddlewareBuilder) Close() error
Close is a cleanup function to close the file watcher when the MiddlewareBuilder is no longer needed.
func (*MiddlewareBuilder) UpdatePolicy ¶
func (b *MiddlewareBuilder) UpdatePolicy() error
UpdatePolicy is a method that reloads the enforcement policy from the policy file.