Documentation
¶
Index ¶
- Constants
- Variables
- func Check(ctx context.Context, res restrict.Resource, opts ...CheckOption) (entities.Subject, error)
- func CtxWithRBAC(ctx context.Context, rbac RBAC) context.Context
- func IsErrAccessDenied(err error) error
- func New(pol *restrict.PolicyDefinition) (*rbac, error)
- func UseResource(rsc string) restrict.Resource
- type CheckOption
- type RBAC
Constants ¶
View Source
const RBACCtxKey rbacCtxKey = "rbac"
Variables ¶
View Source
var ( ErrBadSubject = errors.New("bad subject in token") ErrAccessDenied = errors.New("access denied") )
View Source
var (
ErrNotAuthorized = errors.New("not authorized")
)
Functions ¶
func Check ¶
func Check(ctx context.Context, res restrict.Resource, opts ...CheckOption) (entities.Subject, error)
Check is a convenience function to pull the RBAC instance out of ctx and Check.
func IsErrAccessDenied ¶
func New ¶
func New(pol *restrict.PolicyDefinition) (*rbac, error)
func UseResource ¶
Types ¶
type CheckOption ¶
type CheckOption func(*checkOptions)
func WithActions ¶
func WithActions(actions ...string) CheckOption
func WithContext ¶
func WithContext(ctx restrict.Context) CheckOption
Click to show internal directories.
Click to hide internal directories.