Documentation ¶
Index ¶
- func RegisterPolicyCheckerFactory(f PolicyCheckerFactory)
- type MockChannelPolicyManager
- type MockChannelPolicyManagerGetter
- type MockIdentity
- func (id *MockIdentity) GetIdentifier() *msp.IdentityIdentifier
- func (id *MockIdentity) GetMSPIdentifier() string
- func (id *MockIdentity) GetOrganizationalUnits() []*msp.OUIdentifier
- func (id *MockIdentity) SatisfiesPrincipal(p *mspproto.MSPPrincipal) error
- func (id *MockIdentity) Serialize() ([]byte, error)
- func (id *MockIdentity) Validate() error
- func (id *MockIdentity) Verify(msg []byte, sig []byte) error
- func (id *MockIdentity) VerifyAttributes(proof []byte, spec *msp.AttributeProofSpec) error
- func (id *MockIdentity) VerifyOpts(msg []byte, sig []byte, opts msp.SignatureOpts) error
- type MockIdentityDeserializer
- type MockMSPPrincipalGetter
- type MockPolicy
- type PolicyChecker
- type PolicyCheckerFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterPolicyCheckerFactory ¶ added in v1.0.0
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 MockChannelPolicyManager ¶
func (*MockChannelPolicyManager) BasePath ¶
func (m *MockChannelPolicyManager) BasePath() string
func (*MockChannelPolicyManager) GetPolicy ¶
func (m *MockChannelPolicyManager) GetPolicy(id string) (policies.Policy, bool)
func (*MockChannelPolicyManager) Manager ¶
func (m *MockChannelPolicyManager) Manager(path []string) (policies.Manager, bool)
func (*MockChannelPolicyManager) PolicyNames ¶
func (m *MockChannelPolicyManager) PolicyNames() []string
type MockIdentity ¶
type MockIdentity struct {
// contains filtered or unexported fields
}
func (*MockIdentity) GetIdentifier ¶
func (id *MockIdentity) GetIdentifier() *msp.IdentityIdentifier
func (*MockIdentity) GetMSPIdentifier ¶
func (id *MockIdentity) GetMSPIdentifier() string
func (*MockIdentity) GetOrganizationalUnits ¶
func (id *MockIdentity) GetOrganizationalUnits() []*msp.OUIdentifier
func (*MockIdentity) SatisfiesPrincipal ¶
func (id *MockIdentity) SatisfiesPrincipal(p *mspproto.MSPPrincipal) error
func (*MockIdentity) Serialize ¶
func (id *MockIdentity) Serialize() ([]byte, error)
func (*MockIdentity) Validate ¶
func (id *MockIdentity) Validate() error
func (*MockIdentity) VerifyAttributes ¶
func (id *MockIdentity) VerifyAttributes(proof []byte, spec *msp.AttributeProofSpec) error
func (*MockIdentity) VerifyOpts ¶
func (id *MockIdentity) VerifyOpts(msg []byte, sig []byte, opts msp.SignatureOpts) error
type MockIdentityDeserializer ¶
func (*MockIdentityDeserializer) DeserializeIdentity ¶
func (d *MockIdentityDeserializer) DeserializeIdentity(serializedIdentity []byte) (msp.Identity, error)
type MockMSPPrincipalGetter ¶
type MockMSPPrincipalGetter struct {
Principal []byte
}
func (*MockMSPPrincipalGetter) Get ¶
func (m *MockMSPPrincipalGetter) Get(role string) (*mspproto.MSPPrincipal, error)
type MockPolicy ¶
type MockPolicy struct {
Deserializer msp.IdentityDeserializer
}
func (*MockPolicy) Evaluate ¶
func (m *MockPolicy) Evaluate(signatureSet []*common.SignedData) error
Evaluate takes a set of SignedData and evaluates whether this set of signatures satisfies the policy
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 []*common.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 ¶ added in v1.0.0
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 ¶ added in v1.0.0
type PolicyCheckerFactory interface {
NewPolicyChecker() PolicyChecker
}
PolicyCheckerFactory defines a factory interface so that the actual implementation can be injected