github.com/cilium/cilium@v1.16.2/pkg/auth/always_pass_authhandler.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright Authors of Cilium 3 4 package auth 5 6 import ( 7 "github.com/sirupsen/logrus" 8 9 "github.com/cilium/cilium/api/v1/models" 10 "github.com/cilium/cilium/pkg/auth/certs" 11 "github.com/cilium/cilium/pkg/policy" 12 "github.com/cilium/cilium/pkg/time" 13 ) 14 15 // alwaysPassAuthHandler implements an authHandler by just authenticate every request 16 // This is only for testing purpose. 17 type alwaysPassAuthHandler struct { 18 logger logrus.FieldLogger 19 } 20 21 func newAlwaysPassAuthHandler(logger logrus.FieldLogger) *alwaysPassAuthHandler { 22 return &alwaysPassAuthHandler{ 23 logger: logger, 24 } 25 } 26 27 func (r *alwaysPassAuthHandler) authenticate(authReq *authRequest) (*authResponse, error) { 28 // Authentication trivially done 29 r.logger.Debug("Successfully authenticated request") 30 31 return &authResponse{ 32 expirationTime: time.Now().Add(1 * time.Minute), 33 }, nil 34 } 35 36 func (r *alwaysPassAuthHandler) authType() policy.AuthType { 37 // return a dummy auth type as this auth type is used only for testing 38 return policy.AuthType(100) 39 } 40 41 func (r *alwaysPassAuthHandler) subscribeToRotatedIdentities() <-chan certs.CertificateRotationEvent { 42 return nil 43 } 44 45 func (r *alwaysPassAuthHandler) certProviderStatus() *models.Status { 46 return nil // reporting no status as we have no cert provider 47 }