Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetPolicies ¶
SetPolicies loads a list of policies from a yaml file.
Types ¶
type AccessPolicy ¶
type AccessPolicy struct { Name string `yaml:"name"` DefaultPolicy string `yaml:"defaultPolicy"` Rules []Rule `yaml:"rules"` }
AccessPolicy describes the format of our policies/*
type AccessRequest ¶
AccessRequest model info @Description Requests access to a url @Description for a user with a certain role given by token
type AccessResponse ¶
type AccessResponse struct {
Permission Permission `json:"permission"`
}
AccessResponse model info @Description Response to a request for access to a url @Description for a user with a certain role given by token
func CanAccess ¶
func CanAccess(accRec AccessRequest) AccessResponse
CanAccess takes an AccessRequest and returns an AccessResponse. The AccessResponse contains the permission to access the url. The url get evaluated against the policies, before a response is returned.
type Permission ¶
type Permission string
Permission model info @Description Permission to access a url @Description Used in AccessResponse
const ( Allow Permission = "allow" Deny Permission = "deny" )