auth_engine

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

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 (s *TestSuite) TestGetUnknownRelationship(t *testing.T)

func (*TestSuite) TestSetAndGetActorRelationship

func (s *TestSuite) TestSetAndGetActorRelationship(t *testing.T)

func (*TestSuite) TestSetAndGetActorSetRelationship

func (s *TestSuite) TestSetAndGetActorSetRelationship(t *testing.T)

func (*TestSuite) TestSetAndGetAllActorsRelationship

func (s *TestSuite) TestSetAndGetAllActorsRelationship(t *testing.T)

func (*TestSuite) TestSetAndGetPolicy

func (s *TestSuite) TestSetAndGetPolicy(t *testing.T)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL