Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultURL default Keto server URL DefaultURL = "http://localhost:4466" // DefaultFlavor default Keto flavor to be used DefaultFlavor = FlavorGlob // DefaultTimeout maximum call duration to Keto Server before considered as timeout DefaultTimeout = 5 * time.Second )
View Source
const ( // ActionCreate action to create a resource ActionCreate = "actions:create" // ActionRead action to read a resource ActionRead = "actions:read" // ActionUpdate action to update a resource ActionUpdate = "actions:update" // ActionDelete action to delete a resource ActionDelete = "actions:delete" // ActionAll all action ActionAll = "actions:**" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder builder of enforcer.Enforcer
func NewEnforcerBuilder ¶
func NewEnforcerBuilder() *Builder
NewEnforcerBuilder create new enforcer builder with all default parameters
type Enforcer ¶
type Enforcer interface {
// Enforce check whether user is authorized to do certain action against a resource
Enforce(user string, resource string, action string) (*bool, error)
// FilterAuthorizedResource filter and return list of authorized resource for certain user
FilterAuthorizedResource(user string, resources []string, action string) ([]string, error)
// GetRole get role with name
GetRole(roleName string) (*types.Role, error)
// GetPolicy get policy with name
GetPolicy(policyName string) (*types.Policy, error)
// UpsertRole create or update a role containing member as specified by users argument
UpsertRole(roleName string, users []string) (*types.Role, error)
// UpsertPolicy create or update a policy to allow subjects do actions against the specified resources
UpsertPolicy(
policyName string,
roles []string,
users []string,
resources []string,
actions []string,
) (*types.Policy, error)
}
Enforcer thin client providing interface for authorizing users
Click to show internal directories.
Click to hide internal directories.