Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ConditionFactories = map[string]func() Condition{ new(StringEqualCondition).GetName(): func() Condition { return new(StringEqualCondition) }, }
ConditionFactories is where you can add custom conditions
Functions ¶
This section is empty.
Types ¶
type Condition ¶
type Condition interface {
// GetName returns the condition's name.
GetName() string
// Fulfills returns true if the request is fulfilled by the condition.
Fulfills(interface{}, *Request) bool
// Value set value to the condition.
Values(string, map[string]interface{}) bool
}
Condition either do or do not fulfill an access request.
type Conditions ¶
Conditions is a collection of conditions.
func (Conditions) AddCondition ¶
func (cs Conditions) AddCondition(key string, c Condition)
AddCondition adds a condition to the collection.
func (Conditions) MarshalJSON ¶
func (cs Conditions) MarshalJSON() ([]byte, error)
MarshalJSON marshals a list of conditions to json.
func (Conditions) UnmarshalJSON ¶
func (cs Conditions) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a list of conditions from json.
type Request ¶
type Request struct {
// Resource is the resource that access is requested to.
Resource string `json:"resource"`
// Action is the action that is requested on the resource.
Action string `json:"action"`
// Subejct is the subject that is requesting access.
Subject string `json:"subject"`
// Context is the request's environmental context.
Context Context `json:"context"`
}
Request is the warden's request object.
type StringEqualCondition ¶
type StringEqualCondition struct {
Equals string `json:"equals"`
}
func (*StringEqualCondition) Fulfills ¶
func (c *StringEqualCondition) Fulfills(value interface{}, _ *Request) bool
Fulfills returns true if the given value is a string and is the same as in StringEqualCondition.Equals
func (*StringEqualCondition) GetName ¶
func (c *StringEqualCondition) GetName() string
GetName returns the condition's name.
Click to show internal directories.
Click to hide internal directories.