Documentation ¶
Index ¶
- Constants
- Variables
- func NewChainRoundTripper(onErrorDrop, onValidationDrop bool, violationErrorCode int, chain Chain, ...) http.RoundTripper
- func NewPrivacyContextSupplierRoundTripper(roundTripper http.RoundTripper, supplier ContextSupplier) http.RoundTripper
- type BasicChain
- type BasicPrivacyContextSupplier
- type BucketPrivacyFilter
- type Chain
- type ChainRoundTripper
- type Config
- type Context
- type ContextSupplier
- type Filter
- type SupplierRoundTripper
- type ViolationType
Constants ¶
const ( //RequestPrivacyContextKey is the key under which PrivacyContext can be found in context.Context RequestPrivacyContextKey = log.ContextKey("RequestPrivacyContextKey") )
Variables ¶
var ErrPrivacyContextNotPresent = errors.New("privacy context not present")
ErrPrivacyContextNotPresent indicates that the privacy.Context is not present in request's context.Context
Functions ¶
func NewChainRoundTripper ¶
func NewChainRoundTripper(onErrorDrop, onValidationDrop bool, violationErrorCode int, chain Chain, roundTripper http.RoundTripper) http.RoundTripper
NewChainRoundTripper creates an instance of ChainRoundTripper
func NewPrivacyContextSupplierRoundTripper ¶
func NewPrivacyContextSupplierRoundTripper(roundTripper http.RoundTripper, supplier ContextSupplier) http.RoundTripper
NewPrivacyContextSupplierRoundTripper creates an instance of SupplierRoundTripper
Types ¶
type BasicChain ¶
type BasicChain struct {
// contains filtered or unexported fields
}
BasicChain runs each of the filters on the request until the first violation/errror is returned
func (*BasicChain) Filter ¶
func (basicChain *BasicChain) Filter(req *http.Request) (ViolationType, error)
Filter checks for privacy context presence and runs the supplied filters on the req
type BasicPrivacyContextSupplier ¶
type BasicPrivacyContextSupplier struct {
// contains filtered or unexported fields
}
BasicPrivacyContextSupplier is a basic implemtation of ContextSupplier
type BucketPrivacyFilter ¶
type BucketPrivacyFilter struct {
// contains filtered or unexported fields
}
BucketPrivacyFilter checks if any of the bucket policies are violated
func NewBucketPrivacyFilter ¶
func NewBucketPrivacyFilter(fetcher metadata.BucketMetaDataFetcher) *BucketPrivacyFilter
NewBucketPrivacyFilter creates an instance of BucketPrivacyFilter
func (*BucketPrivacyFilter) Filter ¶
func (filter *BucketPrivacyFilter) Filter(req *http.Request, prvCtx *Context) (ViolationType, error)
Filter checks for bucket-based violations
type Chain ¶
type Chain interface {
Filter(req *http.Request) (ViolationType, error)
}
Chain runs a set of filters on a req to determine wether any privacy policies have been violated
func NewBasicChain ¶
NewBasicChain creates an instance of BasicChain
type ChainRoundTripper ¶
type ChainRoundTripper struct {
// contains filtered or unexported fields
}
ChainRoundTripper uses the supplied Chain to determine any privacy policy violations
type Config ¶
type Config struct { IsInternalNetworkHeaderName string `yaml:"IsInternalNetworkHeaderName"` IsInternalNetworkHeaderValue string `yaml:"IsInternalNetworkHeaderValue"` ShouldDropRequests bool `yaml:"ShouldDropRequests"` DropOnError bool `yaml:"DropOnError"` DropOnValidation bool `yaml:"DropOnValidation"` ViolationErrorCode int `yaml:"ViolationErrorCode"` }
Config is a configuration for ContextSupplier
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context holds the privacy settings associated with the request
type ContextSupplier ¶
ContextSupplier supplies the context.Context of req with a privacy context
func NewBasicPrivacyContextSupplier ¶
func NewBasicPrivacyContextSupplier(config *Config) ContextSupplier
NewBasicPrivacyContextSupplier creates an instance of BasicPrivacyContextSupplier
type Filter ¶
type Filter = func(req *http.Request, prvCtx *Context) (ViolationType, error)
Filter is a funcion that check requests for a specific violation
func NewBucketPrivacyFilterFunc ¶
func NewBucketPrivacyFilterFunc(fetcher metadata.BucketMetaDataFetcher) Filter
NewBucketPrivacyFilterFunc BucketPrivacyFilter in Filter so it can be used in Chain
type SupplierRoundTripper ¶
type SupplierRoundTripper struct {
// contains filtered or unexported fields
}
SupplierRoundTripper supplies the request with a privacy context using the given Supplier
type ViolationType ¶
type ViolationType int
ViolationType is an code indiciating which (if any) privacy policy has been violated
const ( //NoViolation means that no violations have been deteced NoViolation ViolationType = iota //InternalNetworkBucket means that access to internal-network-only bucket has been requested //from an external network InternalNetworkBucket )