Documentation ¶
Overview ¶
- Copyright 2017 - 2019 KB Kontrakt LLC - All Rights Reserved. *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. *
Package auth is a generated GoMock package.
- Copyright 2017 - 2019 KB Kontrakt LLC - All Rights Reserved. *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. *
Package auth is a generated GoMock package.
- Copyright 2017 - 2019 KB Kontrakt LLC - All Rights Reserved. *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. *
Package auth is a generated GoMock package.
Index ¶
- Variables
- type ACL
- type ACLRepository
- type ACLService
- type AccessName
- type AttributeValue
- type ControlList
- type IdentityService
- type MatchAccessListFunc
- func CombineMatchAccessAnd(funcs ...MatchAccessListFunc) MatchAccessListFunc
- func CombineMatchAccessOr(funcs ...MatchAccessListFunc) MatchAccessListFunc
- func MatchAccessAttrs() MatchAccessListFunc
- func MatchAccessCertID() MatchAccessListFunc
- func MatchAccessForAll() MatchAccessListFunc
- func MatchAccessInverseFunc(fn MatchAccessListFunc) MatchAccessListFunc
- func MatchAccessMspID() MatchAccessListFunc
- type MockACLRepository
- type MockACLRepositoryMockRecorder
- type MockACLService
- type MockACLServiceMockRecorder
- type MockIdentityService
- func (m *MockIdentityService) Cert() (*x509.Certificate, error)
- func (m *MockIdentityService) CertID() (string, error)
- func (m *MockIdentityService) CreatorID() (string, error)
- func (m *MockIdentityService) EXPECT() *MockIdentityServiceMockRecorder
- func (m *MockIdentityService) GetAttribute(attrName string) (AttributeValue, error)
- func (m *MockIdentityService) MspID() (string, error)
- type MockIdentityServiceMockRecorder
- func (mr *MockIdentityServiceMockRecorder) Cert() *gomock.Call
- func (mr *MockIdentityServiceMockRecorder) CertID() *gomock.Call
- func (mr *MockIdentityServiceMockRecorder) CreatorID() *gomock.Call
- func (mr *MockIdentityServiceMockRecorder) GetAttribute(attrName interface{}) *gomock.Call
- func (mr *MockIdentityServiceMockRecorder) MspID() *gomock.Call
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAccessNameNotFound . ErrAccessNameNotFound = errors.New("access name not found") // ErrAccessRestricted . ErrAccessRestricted = errors.New("access restricted") )
Functions ¶
This section is empty.
Types ¶
type ACL ¶
type ACL map[AccessName]ControlList
ACL .
func (ACL) CheckAccess ¶
func (acl ACL) CheckAccess(name AccessName, idSvc IdentityService, matchFunc MatchAccessListFunc) error
CheckAccess .
type ACLRepository ¶
ACLRepository .
func NewACLRepositoryImpl ¶
func NewACLRepositoryImpl(stub extstub.MarshalStub) ACLRepository
NewACLRepositoryImpl creates default acl implementation
type ACLService ¶
ACLService .
func NewACLServiceImpl ¶
func NewACLServiceImpl(aclRep ACLRepository, idSvc IdentityService, matchFunc MatchAccessListFunc) ACLService
NewACLServiceImpl creates default implementation
type AttributeValue ¶
AttributeValue defines structure for attributes.
type ControlList ¶
type ControlList struct { All bool `json:"all,omitempty"` Attrs map[string][]string `json:"attrs,omitempty"` MspID map[string]bool `json:"msp,omitempty"` CertID map[string]bool `json:"cid,omitempty"` }
ControlList .
type IdentityService ¶
type IdentityService interface { // ID returns id for group of users/clients MspID() (string, error) // CreatorID returns id for concrete user/client CreatorID() (string, error) // Cert returns user/client cert Cert() (*x509.Certificate, error) // CertID returns issue+subj of concrete user/client cert CertID() (string, error) // GetAttribute returns cert attribute GetAttribute(attrName string) (AttributeValue, error) }
IdentityService defines identity of the user/client.
func NewIdentityServiceImpl ¶
func NewIdentityServiceImpl(stub shim.ChaincodeStubInterface) IdentityService
NewIdentityServiceImpl returns default implementation
type MatchAccessListFunc ¶
type MatchAccessListFunc func(name AccessName, ctrlList ControlList, idSvc IdentityService) error
MatchAccessListFunc .
func CombineMatchAccessAnd ¶
func CombineMatchAccessAnd(funcs ...MatchAccessListFunc) MatchAccessListFunc
CombineMatchAccessAnd .
func CombineMatchAccessOr ¶
func CombineMatchAccessOr(funcs ...MatchAccessListFunc) MatchAccessListFunc
CombineMatchAccessOr .
func MatchAccessInverseFunc ¶
func MatchAccessInverseFunc(fn MatchAccessListFunc) MatchAccessListFunc
MatchAccessInverseFunc .
type MockACLRepository ¶
type MockACLRepository struct {
// contains filtered or unexported fields
}
MockACLRepository is a mock of ACLRepository interface
func NewMockACLRepository ¶
func NewMockACLRepository(ctrl *gomock.Controller) *MockACLRepository
NewMockACLRepository creates a new mock instance
func (*MockACLRepository) EXPECT ¶
func (m *MockACLRepository) EXPECT() *MockACLRepositoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockACLRepository) Get ¶
func (m *MockACLRepository) Get() (ACL, error)
Get mocks base method
func (*MockACLRepository) Save ¶
func (m *MockACLRepository) Save(acl ACL) error
Save mocks base method
type MockACLRepositoryMockRecorder ¶
type MockACLRepositoryMockRecorder struct {
// contains filtered or unexported fields
}
MockACLRepositoryMockRecorder is the mock recorder for MockACLRepository
func (*MockACLRepositoryMockRecorder) Get ¶
func (mr *MockACLRepositoryMockRecorder) Get() *gomock.Call
Get indicates an expected call of Get
func (*MockACLRepositoryMockRecorder) Save ¶
func (mr *MockACLRepositoryMockRecorder) Save(acl interface{}) *gomock.Call
Save indicates an expected call of Save
type MockACLService ¶
type MockACLService struct {
// contains filtered or unexported fields
}
MockACLService is a mock of ACLService interface
func NewMockACLService ¶
func NewMockACLService(ctrl *gomock.Controller) *MockACLService
NewMockACLService creates a new mock instance
func (*MockACLService) EXPECT ¶
func (m *MockACLService) EXPECT() *MockACLServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockACLService) IsAllow ¶
func (m *MockACLService) IsAllow(accessName string) error
IsAllow mocks base method
type MockACLServiceMockRecorder ¶
type MockACLServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockACLServiceMockRecorder is the mock recorder for MockACLService
func (*MockACLServiceMockRecorder) IsAllow ¶
func (mr *MockACLServiceMockRecorder) IsAllow(accessName interface{}) *gomock.Call
IsAllow indicates an expected call of IsAllow
type MockIdentityService ¶
type MockIdentityService struct {
// contains filtered or unexported fields
}
MockIdentityService is a mock of IdentityService interface
func NewMockIdentityService ¶
func NewMockIdentityService(ctrl *gomock.Controller) *MockIdentityService
NewMockIdentityService creates a new mock instance
func (*MockIdentityService) Cert ¶
func (m *MockIdentityService) Cert() (*x509.Certificate, error)
Cert mocks base method
func (*MockIdentityService) CertID ¶
func (m *MockIdentityService) CertID() (string, error)
CertID mocks base method
func (*MockIdentityService) CreatorID ¶
func (m *MockIdentityService) CreatorID() (string, error)
CreatorID mocks base method
func (*MockIdentityService) EXPECT ¶
func (m *MockIdentityService) EXPECT() *MockIdentityServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockIdentityService) GetAttribute ¶
func (m *MockIdentityService) GetAttribute(attrName string) (AttributeValue, error)
GetAttribute mocks base method
func (*MockIdentityService) MspID ¶
func (m *MockIdentityService) MspID() (string, error)
MspID mocks base method
type MockIdentityServiceMockRecorder ¶
type MockIdentityServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockIdentityServiceMockRecorder is the mock recorder for MockIdentityService
func (*MockIdentityServiceMockRecorder) Cert ¶
func (mr *MockIdentityServiceMockRecorder) Cert() *gomock.Call
Cert indicates an expected call of Cert
func (*MockIdentityServiceMockRecorder) CertID ¶
func (mr *MockIdentityServiceMockRecorder) CertID() *gomock.Call
CertID indicates an expected call of CertID
func (*MockIdentityServiceMockRecorder) CreatorID ¶
func (mr *MockIdentityServiceMockRecorder) CreatorID() *gomock.Call
CreatorID indicates an expected call of CreatorID
func (*MockIdentityServiceMockRecorder) GetAttribute ¶
func (mr *MockIdentityServiceMockRecorder) GetAttribute(attrName interface{}) *gomock.Call
GetAttribute indicates an expected call of GetAttribute
func (*MockIdentityServiceMockRecorder) MspID ¶
func (mr *MockIdentityServiceMockRecorder) MspID() *gomock.Call
MspID indicates an expected call of MspID