Documentation
¶
Index ¶
- Constants
- type ApplicationPolicyEvaluator
- type ChannelPolicyManagerGetter
- type ChannelPolicyReferenceProvider
- type ChannelPolicyReferenceProviderImpl
- type Identity
- type IdentityDeserializer
- type MSPPrincipalGetter
- type Manager
- type Policy
- type PolicyChecker
- type PolicyManager
- type SignaturePolicyProvider
Constants ¶
const ( // Admins is the label for the local MSP admins Admins = "Admins" // Members is the label for the local MSP members Members = "Members" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 ChannelPolicyManagerGetter ¶
type ChannelPolicyManagerGetter interface {
policies.ChannelPolicyManagerGetter
}
ChannelPolicyManagerGetter is the local interface that used to generate mocks for foreign interface.
type ChannelPolicyReferenceProvider ¶
type ChannelPolicyReferenceProvider interface {
// NewPolicy creates a new policy based on the policy bytes.
NewPolicy(channelConfigPolicyReference string) (policies.Policy, error)
}
ChannelPolicyReferenceProvider is used to determine if a set of signature is valid and complies with a policy.
type ChannelPolicyReferenceProviderImpl ¶
type ChannelPolicyReferenceProviderImpl struct {
Manager
}
type IdentityDeserializer ¶
type IdentityDeserializer interface {
msp.IdentityDeserializer
}
IdentityDeserializer is the local interface that used to generate mocks for foreign interface.
type MSPPrincipalGetter ¶
type MSPPrincipalGetter interface {
// Get returns an MSP principal for the given role
Get(role string) (*protomsp.MSPPrincipal, error)
}
func NewLocalMSPPrincipalGetter ¶
func NewLocalMSPPrincipalGetter(localMSP msp.MSP) MSPPrincipalGetter
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
// CheckPolicyNoChannelBySignedData checks that the passed signed data is valid with the respect to
// passed policy on the local MSP.
CheckPolicyNoChannelBySignedData(policyName string, signedData []*protoutil.SignedData) error
}
PolicyChecker offers methods to check a signed proposal against a specific policy defined in a channel or not.
func NewPolicyChecker ¶
func NewPolicyChecker(channelPolicyManagerGetter policies.ChannelPolicyManagerGetter, localMSP msp.MSP) PolicyChecker
NewPolicyChecker creates a new instance of PolicyChecker
type PolicyManager ¶
PolicyManager is the local interface that used to generate mocks for foreign interface.
type SignaturePolicyProvider ¶
type SignaturePolicyProvider interface {
// NewPolicy creates a new policy based on the policy bytes.
NewPolicy(signaturePolicy *common.SignaturePolicyEnvelope) (policies.Policy, error)
}
SignaturePolicyProvider provides the backing implementation of a policy.