auth

package
v0.0.0-...-051a9c2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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

type ACLRepository interface {
	Get() (ACL, error)
	Save(acl ACL) error
}

ACLRepository .

func NewACLRepositoryImpl

func NewACLRepositoryImpl(stub extstub.MarshalStub) ACLRepository

NewACLRepositoryImpl creates default acl implementation

type ACLService

type ACLService interface {
	IsAllow(accessName string) (err error)
}

ACLService .

func NewACLServiceImpl

func NewACLServiceImpl(aclRep ACLRepository, idSvc IdentityService, matchFunc MatchAccessListFunc) ACLService

NewACLServiceImpl creates default implementation

type AccessName

type AccessName string

AccessName .

type AttributeValue

type AttributeValue struct {
	Value     string
	IsDefined bool
}

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 MatchAccessAttrs

func MatchAccessAttrs() MatchAccessListFunc

MatchAccessAttrs .

func MatchAccessCertID

func MatchAccessCertID() MatchAccessListFunc

MatchAccessCertID .

func MatchAccessForAll

func MatchAccessForAll() MatchAccessListFunc

MatchAccessForAll .

func MatchAccessInverseFunc

func MatchAccessInverseFunc(fn MatchAccessListFunc) MatchAccessListFunc

MatchAccessInverseFunc .

func MatchAccessMspID

func MatchAccessMspID() MatchAccessListFunc

MatchAccessMspID .

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

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

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

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

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

Cert indicates an expected call of Cert

func (*MockIdentityServiceMockRecorder) CertID

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

MspID indicates an expected call of MspID

Jump to

Keyboard shortcuts

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