fixing jwt config issue
@@ -323,8 +323,17 @@ func (r *ReconcileAPI) Reconcile(request reconcile.Request) (reconcile.Result, e
return reconcile.Result{}, errSec
}
for _, jwtConf := range *jwtConfArray {
+ isJwtExist := false
+ for _, jwtIssuers := range apiSecurityConfigs {
+ if strings.EqualFold(jwtConf.Issuer, jwtIssuers.Issuer) {
+ isJwtExist = true
+ break
+ }
+ }
+ if !isJwtExist {
apiSecurityConfigs = append(apiSecurityConfigs, jwtConf)
}
+ }
mgw.Configs.APIKeyConfigs = apiKeyConfArray
//adding security scheme to swagger
@@ -373,11 +382,19 @@ func (r *ReconcileAPI) Reconcile(request reconcile.Request) (reconcile.Result, e
// Default security
if !isDefinedSecurity && resourceLevelSec == 0 {
reqLogger.Info("Use default security")
-
defaultJwtConfArray, err := security.Default(&r.client, userNamespace, ownerRef)
for _, secConf := range *defaultJwtConfArray {
+ isJwtExist := false
+ for _, jwtIssuers := range apiSecurityConfigs {
+ if strings.EqualFold(secConf.Issuer, jwtIssuers.Issuer) {
+ isJwtExist = true
+ break
+ }
+ }
+ if !isJwtExist {
apiSecurityConfigs = append(apiSecurityConfigs, secConf)
}
+ }
if err != nil {
return reconcile.Result{}, err
}
