From f32d9cf9c79ab604f812acdbe57a9e25f2841a59 Mon Sep 17 00:00:00 2001 From: BLasan Date: Thu, 11 Feb 2021 17:04:14 +0530 Subject: [PATCH] fix: adding default jwt token --- api-operator/pkg/controller/api/api_controller.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api-operator/pkg/controller/api/api_controller.go b/api-operator/pkg/controller/api/api_controller.go index e92191cf0..39e3f83f8 100644 --- a/api-operator/pkg/controller/api/api_controller.go +++ b/api-operator/pkg/controller/api/api_controller.go @@ -325,6 +325,8 @@ func (r *ReconcileAPI) Reconcile(request reconcile.Request) (reconcile.Result, e _, secSchemeDefined := swaggerDoc.Extensions[swagger.SecuritySchemeExtension] securityMap, isDefinedSecurity, resourceLevelSec, securityErr := swagger.GetSecurityMap(swaggerDoc) + pathCount := len(swaggerDoc.Paths) + if securityErr != nil { return reconcile.Result{}, securityErr } @@ -392,7 +394,7 @@ func (r *ReconcileAPI) Reconcile(request reconcile.Request) (reconcile.Result, e kaniko.AddVolume(k8s.ConfigMapVolumeMount(swaggerConfMapMgw.Name, fmt.Sprintf(kaniko.SwaggerLocation, i+1))) // Default security - if !isDefinedSecurity && resourceLevelSec == 0 { + if !isDefinedSecurity && resourceLevelSec != pathCount { reqLogger.Info("Use default security") defaultJwtConfArray, err := security.Default(&r.client, userNamespace, ownerRef) for _, secConf := range *defaultJwtConfArray {