Documentation
¶
Index ¶
- func ACLSecurityDynamoRepoExtender(repo backends.Repository) backends.Repository
- func ACLSecurityMongoRepoExtender(repo backends.Repository) backends.Repository
- type ACLRepository
- type ACLSecurityDynamoRepo
- type ACLSecurityMongoRepo
- type ExtendedBackend
- type ExtendedBackendManager
- type PolicyRecord
- type RepoExtender
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ACLSecurityDynamoRepoExtender ¶
func ACLSecurityDynamoRepoExtender(repo backends.Repository) backends.Repository
ACLSecurityDynamoRepoExtender extends the given backends.Repository as ACLRepository.
func ACLSecurityMongoRepoExtender ¶
func ACLSecurityMongoRepoExtender(repo backends.Repository) backends.Repository
ACLSecurityMongoRepoExtender extends the incomping backends.Repository and wraps it in ACLSecurityMongoRepo.
Types ¶
type ACLRepository ¶
type ACLRepository interface {
// Repository is the wrapped backends.Repository.
backends.Repository
// FindPolicies performs lookup for policies that match the input filter.
FindPolicies(filter map[string]string) ([]*PolicyRecord, error)
}
ACLRepository extends the backends.Repository interface by adding new functions for handling ACL Policies.
type ACLSecurityDynamoRepo ¶
type ACLSecurityDynamoRepo struct {
*backends.DynamoCollection
}
ACLSecurityDynamoRepo is Dunamodb based extended implemetation for a backends.Repository.
func (*ACLSecurityDynamoRepo) FindPolicies ¶
func (a *ACLSecurityDynamoRepo) FindPolicies(filter map[string]string) ([]*PolicyRecord, error)
FindPolicies looks up ACL policies from Dynamodb backend database based on filter proprties.
type ACLSecurityMongoRepo ¶
type ACLSecurityMongoRepo struct {
*backends.MongoSession
}
ACLSecurityMongoRepo extends the backends.Repository and implements ACLRepository.
func (*ACLSecurityMongoRepo) FindPolicies ¶
func (a *ACLSecurityMongoRepo) FindPolicies(filter map[string]string) ([]*PolicyRecord, error)
FindPolicies performs a lookup in the MongoDB to find policies that match the provided values for action, subject and/or resource.
type ExtendedBackend ¶
ExtendedBackend wraps a backends.Backend and adds capabilities for creating repositories with extended functionalities.
func (*ExtendedBackend) DefineRepository ¶
func (eb *ExtendedBackend) DefineRepository(name string, def backends.RepositoryDefinition) (backends.Repository, error)
DefineRepository defines a repository and extends it with a registered RepoExtender, if available.
func (*ExtendedBackend) GetRepository ¶
func (eb *ExtendedBackend) GetRepository(name string) (backends.Repository, error)
GetRepository returns a defined extended repository .
type ExtendedBackendManager ¶
type ExtendedBackendManager struct {
backends.BackendManager
// contains filtered or unexported fields
}
ExtendedBackendManager wraps backends.BackendManager that manages extended Backends.
func WrapBackendManager ¶
func WrapBackendManager(manager backends.BackendManager, supportedBackends map[string]RepoExtender) *ExtendedBackendManager
WrapBackendManager wraps an existing backends.BackendManager into an ExtendedBackendManager.
func (*ExtendedBackendManager) GetBackend ¶
func (em *ExtendedBackendManager) GetBackend(backendType string) (backends.Backend, error)
GetBackend returns extended backends.Backend.
type PolicyRecord ¶
type PolicyRecord struct {
// The ID of the policy document
ID string `json:"id" bson:"id"`
// Description is the human readable description of the document.
Description string `json:"description" bson:"description"`
// List of subjects (may be patterns) to which this policy applies.
Subjects []string `json:"subjects" bson:"subjects"`
// Effect is the effect of this policy if applied to the requested resource. May be "allow" or "deny".
Effect string `json:"effect" bson:"effect"`
// Resources is a list of resources (may be patterns) to which this policy applies.
Resources []string `json:"resources" bson:"resources"`
// Actions is a list of actions (may be patterns) to which this policy applies.
Actions []string `json:"actions" bson:"actions"`
// CreatedAt is a timestamp of when this policy was created.
CreatedAt int64 `json:"createdAt" bson:"createdAt"`
// Conditions holds the conditions serialized as JSON string.
Conditions string `json:"conditions" bson:"conditions"`
// CreatedBy is the user id of the user who created this policy
CreatedBy string `json:"createdBy" bson:"createdBy"`
// CompiledActions is the compiled regular expression to match the action.
CompiledActions []string `json:"compiledActions" bson:"compiledActions"`
// CompiledResources is the compiled regular expression to match the resource.
CompiledResources []string `json:"compiledResources" bson:"compiledResources"`
// CompiledSubjects is the compiled regular expression to match the subject.
CompiledSubjects []string `json:"compiledSubjects" bson:"compiledSubjects"`
}
PolicyRecord is an ACL policy stored in Mongodb.
type RepoExtender ¶
type RepoExtender func(backends.Repository) backends.Repository
RepoExtender extends (decorates) exiting backends.Repository with additional capabilities. This is a decorator function type. The return value must also be backends.Repository.