github.com/yimialmonte/fabric@v2.1.1+incompatible/core/handlers/library/library.go (about) 1 /* 2 Copyright IBM Corp, SecureKey Technologies Inc. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package library 8 9 import ( 10 "github.com/hyperledger/fabric/core/handlers/auth" 11 "github.com/hyperledger/fabric/core/handlers/auth/filter" 12 "github.com/hyperledger/fabric/core/handlers/decoration" 13 "github.com/hyperledger/fabric/core/handlers/decoration/decorator" 14 endorsement "github.com/hyperledger/fabric/core/handlers/endorsement/api" 15 "github.com/hyperledger/fabric/core/handlers/endorsement/builtin" 16 validation "github.com/hyperledger/fabric/core/handlers/validation/api" 17 . "github.com/hyperledger/fabric/core/handlers/validation/builtin" 18 ) 19 20 // HandlerLibrary is used to assert 21 // how to create the various handlers 22 type HandlerLibrary struct { 23 } 24 25 // DefaultAuth creates a default auth.Filter 26 // that doesn't do any access control checks - simply 27 // forwards the request further. 28 // It needs to be initialized via a call to Init() 29 // and be passed a peer.EndorserServer 30 func (r *HandlerLibrary) DefaultAuth() auth.Filter { 31 return filter.NewFilter() 32 } 33 34 // ExpirationCheck is an auth filter which blocks requests 35 // from identities with expired x509 certificates 36 func (r *HandlerLibrary) ExpirationCheck() auth.Filter { 37 return filter.NewExpirationCheckFilter() 38 } 39 40 // DefaultDecorator creates a default decorator 41 // that doesn't do anything with the input, simply 42 // returns the input as output. 43 func (r *HandlerLibrary) DefaultDecorator() decoration.Decorator { 44 return decorator.NewDecorator() 45 } 46 47 func (r *HandlerLibrary) DefaultEndorsement() endorsement.PluginFactory { 48 return &builtin.DefaultEndorsementFactory{} 49 } 50 51 func (r *HandlerLibrary) DefaultValidation() validation.PluginFactory { 52 return &DefaultValidationFactory{} 53 }