policy

package
v2.0.0-alpha+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterPolicyCheckerFactory

func RegisterPolicyCheckerFactory(f PolicyCheckerFactory)

RegisterPolicyCheckerFactory is to be called once to set the factory that will be used to obtain instances of PolicyChecker

Types

type ApplicationPolicyEvaluator

type ApplicationPolicyEvaluator struct {
	// contains filtered or unexported fields
}

func New

func New(deserializer msp.IdentityDeserializer, channel string, channelPolicyManagerGetter policies.ChannelPolicyManagerGetter) (*ApplicationPolicyEvaluator, error)

New returns an evaluator for application policies

func (*ApplicationPolicyEvaluator) Evaluate

func (a *ApplicationPolicyEvaluator) Evaluate(policyBytes []byte, signatureSet []*protoutil.SignedData) error

type ChannelPolicyReferenceProvider

type ChannelPolicyReferenceProvider interface {
	// NewPolicy creates a new policy based on the policy bytes
	NewPolicy(channelConfigPolicyReference string) (policies.Policy, error)
}

ChannelPolicyReference is used to determine if a set of signature is valid and complies with a policy

type ChannelPolicyReferenceProviderImpl

type ChannelPolicyReferenceProviderImpl struct {
	Manager
}

func (*ChannelPolicyReferenceProviderImpl) NewPolicy

func (c *ChannelPolicyReferenceProviderImpl) NewPolicy(channelConfigPolicyReference string) (policies.Policy, error)

type Manager

type Manager interface {
	// GetPolicy returns a policy and true if it was the policy requested, or false if it is the default policy
	GetPolicy(id string) (policies.Policy, bool)
}

Manager defines functions to interface with the policy manager of a channel

type PolicyChecker

type PolicyChecker interface {
	// CheckPolicy checks that the passed signed proposal is valid with the respect to
	// passed policy on the passed channel.
	// If no channel is passed, CheckPolicyNoChannel is invoked directly.
	CheckPolicy(channelID, policyName string, signedProp *pb.SignedProposal) error

	// CheckPolicyBySignedData checks that the passed signed data is valid with the respect to
	// passed policy on the passed channel.
	// If no channel is passed, the method will fail.
	CheckPolicyBySignedData(channelID, policyName string, sd []*protoutil.SignedData) error

	// CheckPolicyNoChannel checks that the passed signed proposal is valid with the respect to
	// passed policy on the local MSP.
	CheckPolicyNoChannel(policyName string, signedProp *pb.SignedProposal) error
}

PolicyChecker offers methods to check a signed proposal against a specific policy defined in a channel or not.

func GetPolicyChecker

func GetPolicyChecker() PolicyChecker

GetPolicyChecker returns instances of PolicyChecker; the actual implementation is controlled by the factory that is registered via RegisterPolicyCheckerFactory

func NewPolicyChecker

func NewPolicyChecker(channelPolicyManagerGetter policies.ChannelPolicyManagerGetter, localMSP msp.IdentityDeserializer, principalGetter mgmt.MSPPrincipalGetter) PolicyChecker

NewPolicyChecker creates a new instance of PolicyChecker

type PolicyCheckerFactory

type PolicyCheckerFactory interface {
	NewPolicyChecker() PolicyChecker
}

PolicyCheckerFactory defines a factory interface so that the actual implementation can be injected

type SignaturePolicyProvider

type SignaturePolicyProvider interface {
	// NewPolicy creates a new policy based on the policy bytes
	NewPolicy(signaturePolicy *common.SignaturePolicyEnvelope) (policies.Policy, error)
}

Provider provides the backing implementation of a policy

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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