Documentation ¶
Index ¶
Constants ¶
View Source
const AuthzAllowRule = "bacalhau.authz.allow"
The name of the rule that must be `true` for the authorization provider to permit access. This is typically provided by a policy with package name `bacalhau.authz` and then by defining a rule `allow`. See `policy_test_allow.rego` for a minimal example.
Variables ¶
View Source
var AlwaysAllow = NewPolicyAuthorizer(AlwaysAllowPolicy)
AlwaysAllow is an authorizer that will always permit access, irrespective of the passed in data, which is useful for testing.
View Source
var AlwaysAllowPolicy = lo.Must(policy.FromFS(policies, "policies/policy_test_allow.rego"))
AlwaysAllowPolicy is a policy that will always permit access, irrespective of the passed in data, which is useful for testing.
Functions ¶
This section is empty.
Types ¶
type Authorization ¶
type Authorizer ¶
type Authorizer interface {
Authorize(req *http.Request) (Authorization, error)
}
func NewPolicyAuthorizer ¶
func NewPolicyAuthorizer(authzPolicy *policy.Policy) Authorizer
PolicyAuthorizer can authorize users by calling out to an external Rego policy containing logic to make decisions about who should be authorized.
Click to show internal directories.
Click to hide internal directories.