Documentation
¶
Index ¶
- func TestAuthEngineImpl(t *testing.T, f SetupFunction)
- type AuthEngine
- type RecordFound
- type SetupFunction
- type TestSuite
- func (s *TestSuite) TestGetUnknownRelationship(t *testing.T)
- func (s *TestSuite) TestSetAndGetActorRelationship(t *testing.T)
- func (s *TestSuite) TestSetAndGetActorSetRelationship(t *testing.T)
- func (s *TestSuite) TestSetAndGetAllActorsRelationship(t *testing.T)
- func (s *TestSuite) TestSetAndGetPolicy(t *testing.T)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestAuthEngineImpl ¶
func TestAuthEngineImpl(t *testing.T, f SetupFunction)
TestAuthEngineImpl executes a series of tests for an AuthEngine. Uses the SetupFunction f in order to initialize the AuthEngine and execute the tests.
Types ¶
type AuthEngine ¶
type AuthEngine interface { // Reurn a Relationship from a Policy, returns nil if Relationship does not exist GetRelationship(ctx context.Context, policy *types.Policy, rel *types.Relationship) (*types.RelationshipRecord, error) // Sets a Relationship within a Policy SetRelationship(ctx context.Context, policy *types.Policy, rec *types.RelationshipRecord) (RecordFound, error) // Returns all Relationships which matches selector FilterRelationships(ctx context.Context, policy *types.Policy, selector *types.RelationshipSelector) ([]*types.RelationshipRecord, error) // GetPolicy returns a PolicyRecord for the given id GetPolicy(ctx context.Context, policyId string) (*types.PolicyRecord, error) // SetPolicy stores a new Policy with the given Id SetPolicy(ctx context.Context, pol *types.PolicyRecord) error // ListPolicyIds returns the IDs of all known Policies ListPolicyIds(ctx context.Context) ([]string, error) // Check verifies whether an Acccess Request is allowed within a certain Policy Check(ctx context.Context, policy *types.Policy, request *types.Operation, actor *types.Actor) (bool, error) // DeleteRelationship removes a Relationship from a Policy DeleteRelationship(ctx context.Context, policy *types.Policy, relationship *types.Relationship) (RecordFound, error) // DeleteRelationships removes all Relationships matching the given selector DeleteRelationships(ctx context.Context, policy *types.Policy, selector *types.RelationshipSelector) (uint, error) }
AuthEngine models an Authorization engine service provider. The engine is responsible for storing Policies and Relationships, as well as evaluating queries.
type RecordFound ¶
type RecordFound bool
type SetupFunction ¶
type SetupFunction func(t *testing.T) (context.Context, AuthEngine)
SetupFunction is a Test setup function which is used to initialize an implementation of some AuthEngine. It is run before each individual test case
type TestSuite ¶
type TestSuite struct {
// contains filtered or unexported fields
}
func (*TestSuite) TestGetUnknownRelationship ¶
func (*TestSuite) TestSetAndGetActorRelationship ¶
func (*TestSuite) TestSetAndGetActorSetRelationship ¶
func (*TestSuite) TestSetAndGetAllActorsRelationship ¶
func (*TestSuite) TestSetAndGetPolicy ¶
Click to show internal directories.
Click to hide internal directories.