Documentation
¶
Index ¶
- Constants
- Variables
- type APIClient
- func (c *APIClient) DeletePolicy(ctx context.Context, id string, headers Headers) error
- func (c *APIClient) GetPermissionsBundle(ctx context.Context, headers Headers) (Bundle, error)
- func (c *APIClient) GetPolicy(ctx context.Context, id string, headers Headers) (*models.Policy, error)
- func (c *APIClient) GetRole(ctx context.Context, id string, headers Headers) (*models.Roles, error)
- func (c *APIClient) GetRoles(ctx context.Context, headers Headers) (*models.Roles, error)
- func (c *APIClient) PostPolicy(ctx context.Context, policy models.PolicyInfo, headers Headers) (*models.Policy, error)
- func (c *APIClient) PostPolicyWithID(ctx context.Context, id string, policy models.PolicyInfo, headers Headers) (*models.Policy, error)
- func (c *APIClient) PutPolicy(ctx context.Context, id string, policy models.Policy, headers Headers) error
- type Bundle
- type Clienter
- type Condition
- type EntityData
- type EntityIDToPolicies
- type HTTPClient
- type Headers
- type Operator
- type Policy
Constants ¶
View Source
const ( Authorization string = "Authorization" BearerPrefix string = "Bearer " )
package level constants
Variables ¶
View Source
var ( // ErrGetPermissionsResponseBodyNil error used when a nil response is returned from the permissions API. ErrGetPermissionsResponseBodyNil = errors.New("error creating get permissions request http.Request required but was nil") // ErrFailedToParsePermissionsResponse error used when an unexpected response body is returned from the permissions API and it fails to parse. ErrFailedToParsePermissionsResponse = errors.New("error parsing permissions bundle response body") // ErrNotCached error error used when permissions are not found in the cache. ErrNotCached = errors.New("permissions bundle not found in the cache") )
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient implementation of permissions.Store that gets permission data from the permissions API
func NewClient ¶
NewClient constructs a new APIClient instance with a default http client and Options.
func NewClientWithClienter ¶
func NewClientWithClienter(host string, httpClient HTTPClient) *APIClient
NewClientWithClienter constructs a new APIClient instance.
func (*APIClient) DeletePolicy ¶ added in v0.20.0
func (*APIClient) GetPermissionsBundle ¶
GetPermissionsBundle gets the permissions bundle data from the permissions API.
func (*APIClient) PostPolicy ¶ added in v0.20.0
func (*APIClient) PostPolicyWithID ¶ added in v1.9.0
type Bundle ¶
type Bundle map[string]EntityIDToPolicies
Bundle is the optimised lookup table for permissions.
type Clienter ¶ added in v1.8.0
type Clienter interface {
GetRoles(ctx context.Context, headers Headers) (*models.Roles, error)
GetRole(ctx context.Context, id string, headers Headers) (*models.Roles, error)
PostPolicy(ctx context.Context, policy models.PolicyInfo, headers Headers) (*models.Policy, error)
PostPolicyWithID(ctx context.Context, id string, policy models.PolicyInfo, headers Headers) (*models.Policy, error)
DeletePolicy(ctx context.Context, id string, headers Headers) error
GetPolicy(ctx context.Context, id string, headers Headers) (*models.Policy, error)
PutPolicy(ctx context.Context, id string, policy models.Policy, headers Headers) error
GetPermissionsBundle(ctx context.Context, headers Headers) (Bundle, error)
}
type Condition ¶
type Condition struct {
Attribute string `json:"attribute"`
Operator Operator `json:"operator"`
Values []string `json:"values"`
}
Condition is used within a policy to match additional attributes.
type EntityData ¶
EntityData groups the different entity types into a single parameter
type EntityIDToPolicies ¶
EntityIDToPolicies maps an entity ID to a slice of policies.
type HTTPClient ¶
HTTPClient is the interface that defines a client for making HTTP requests
Click to show internal directories.
Click to hide internal directories.