Documentation
¶
Index ¶
- Constants
- type ACL
- type Cache
- type FaultFunc
- type KeyPolicy
- type Policy
- type PolicyACL
- func (p *PolicyACL) ACLList() bool
- func (p *PolicyACL) ACLModify() bool
- func (p *PolicyACL) KeyRead(key string) bool
- func (p *PolicyACL) KeyWrite(key string) bool
- func (p *PolicyACL) KeyWritePrefix(prefix string) bool
- func (p *PolicyACL) ServiceRead(name string) bool
- func (p *PolicyACL) ServiceWrite(name string) bool
- type ServicePolicy
- type StaticACL
Constants ¶
const ( KeyPolicyDeny = "deny" KeyPolicyRead = "read" KeyPolicyWrite = "write" ServicePolicyDeny = "deny" ServicePolicyRead = "read" ServicePolicyWrite = "write" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ACL ¶
type ACL interface {
// KeyRead checks for permission to read a given key
KeyRead(string) bool
// KeyWrite checks for permission to write a given key
KeyWrite(string) bool
// KeyWritePrefix checks for permission to write to an
// entire key prefix. This means there must be no sub-policies
// that deny a write.
KeyWritePrefix(string) bool
// ServiceWrite checks for permission to read a given service
ServiceWrite(string) bool
// ServiceRead checks for permission to read a given service
ServiceRead(string) bool
// ACLList checks for permission to list all the ACLs
ACLList() bool
// ACLModify checks for permission to manipulate ACLs
ACLModify() bool
}
ACL is the interface for policy enforcement.
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is used to implement policy and ACL caching
func (*Cache) GetACL ¶
GetACL is used to get a potentially cached ACL policy. If not cached, it will be generated and then cached.
func (*Cache) GetACLPolicy ¶
GetACLPolicy is used to get the potentially cached ACL policy. If not cached, it will be generated and then cached.
type FaultFunc ¶
FaultFunc is a function used to fault in the parent, rules for an ACL given it's ID
type Policy ¶
type Policy struct {
ID string `hcl:"-"`
Keys []*KeyPolicy `hcl:"key,expand"`
Services []*ServicePolicy `hcl:"service,expand"`
}
Policy is used to represent the policy specified by an ACL configuration.
type PolicyACL ¶
type PolicyACL struct {
// contains filtered or unexported fields
}
PolicyACL is used to wrap a set of ACL policies to provide the ACL interface.
func New ¶
New is used to construct a policy based ACL from a set of policies and a parent policy to resolve missing cases.
func (*PolicyACL) KeyWritePrefix ¶
KeyWritePrefix returns if a prefix is allowed to be written
func (*PolicyACL) ServiceRead ¶ added in v0.5.0
ServiceRead checks if reading (discovery) of a service is allowed
func (*PolicyACL) ServiceWrite ¶ added in v0.5.0
ServiceWrite checks if writing (registering) a service is allowed
type ServicePolicy ¶ added in v0.5.0
ServicePolicy represents a policy for a service
func (*ServicePolicy) GoString ¶ added in v0.5.0
func (k *ServicePolicy) GoString() string
type StaticACL ¶
type StaticACL struct {
// contains filtered or unexported fields
}
StaticACL is used to implement a base ACL policy. It either allows or denies all requests. This can be used as a parent ACL to act in a blacklist or whitelist mode.