Documentation ¶
Overview ¶
Package rbac provides RBAC middleware utilies for the Everest API server.
Index ¶
- func Can(ctx context.Context, filePath string, k *kubernetes.Kubernetes, req ...string) (bool, error)
- func GetUser(c echo.Context) (string, error)
- func NewEnforceHandler(basePath string, enforcer *casbin.Enforcer) func(c echo.Context, user string) (bool, error)
- func NewEnforcer(ctx context.Context, kubeClient *kubernetes.Kubernetes, l *zap.SugaredLogger) (*casbin.Enforcer, error)
- func NewEnforcerFromFilePath(filePath string) (*casbin.Enforcer, error)
- func NewSkipper(basePath string) (func(echo.Context) bool, error)
- func ValidatePolicy(ctx context.Context, k *kubernetes.Kubernetes, filepath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Can ¶
func Can(ctx context.Context, filePath string, k *kubernetes.Kubernetes, req ...string) (bool, error)
Can checks if a user is allowed to perform an action on a resource. Input request should be of the form [user action resource object].
func NewEnforceHandler ¶
func NewEnforceHandler(basePath string, enforcer *casbin.Enforcer) func(c echo.Context, user string) (bool, error)
NewEnforceHandler returns a function that checks if a user is allowed to access a resource.
func NewEnforcer ¶
func NewEnforcer(ctx context.Context, kubeClient *kubernetes.Kubernetes, l *zap.SugaredLogger) (*casbin.Enforcer, error)
NewEnforcer creates a new Casbin enforcer with the RBAC model and ConfigMap adapter.
func NewEnforcerFromFilePath ¶
NewEnforcerFromFilePath creates a new Casbin enforcer with the policy stored at the given filePath.
func NewSkipper ¶
NewSkipper returns a new function that checks if a given request should be skipped from RBAC checks.
func ValidatePolicy ¶
func ValidatePolicy( ctx context.Context, k *kubernetes.Kubernetes, filepath string, ) error
ValidatePolicy validates a policy from either Kubernetes or local file.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package configmapadapter provides a Casbin adapter that uses a Kubernetes ConfigMap as the storage.
|
Package configmapadapter provides a Casbin adapter that uses a Kubernetes ConfigMap as the storage. |
Package fileadapter provides a file adapter for Casbin.
|
Package fileadapter provides a file adapter for Casbin. |
Package utils contains utility functions for RBAC.
|
Package utils contains utility functions for RBAC. |