ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject ignite git commit: ignite-1219 Trust managers validation.
Date Fri, 02 Oct 2015 01:33:48 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 aad6eb215 -> 7db239961


ignite-1219 Trust managers validation.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7db23996
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7db23996
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7db23996

Branch: refs/heads/ignite-843
Commit: 7db2399616af4e309093a9a8c776ae0b2eac84b4
Parents: aad6eb2
Author: Vasiliy Sisko <vsisko@gridgain.com>
Authored: Fri Oct 2 08:33:40 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Fri Oct 2 08:33:40 2015 +0700

----------------------------------------------------------------------
 .../main/js/controllers/clusters-controller.js  | 16 ++++++++--
 .../main/js/controllers/models/clusters.json    | 32 ++++++++++----------
 .../src/main/js/helpers/common-utils.js         |  9 +++---
 .../js/routes/generator/generator-common.js     | 18 +++++++++--
 .../main/js/routes/generator/generator-java.js  | 10 ++++--
 .../main/js/routes/generator/generator-xml.js   | 10 ++++--
 6 files changed, 63 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7db23996/modules/control-center-web/src/main/js/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/clusters-controller.js b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
index 772b39b..9ecb7d5 100644
--- a/modules/control-center-web/src/main/js/controllers/clusters-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
@@ -56,6 +56,11 @@ consoleModule.controller('clustersController', [
             $preview.previewInit(preview);
         };
 
+        $scope.trustManagersConfigured = function() {
+            return $scope.backupItem.sslEnabled && $common.isDefined($scope.backupItem.sslContextFactory)
+                && !$common.isEmptyArray($scope.backupItem.sslContextFactory.trustManagers)
+        };
+
         $scope.previewChanged = $preview.previewChanged;
 
         $scope.hidePopover = $common.hidePopover;
@@ -380,9 +385,14 @@ consoleModule.controller('clustersController', [
                     return showPopoverMessage($scope.panels, 'general', 'serviceAccountId',
'Account ID should not be empty');
             }
 
-            if (item.sslEnabled && (!$common.isDefined(item.sslContextFactory)
-                || $common.isEmptyString(item.sslContextFactory.keyStoreFilePath)))
-                return showPopoverMessage($scope.panels, 'sslConfiguration', 'keyStoreFilePath',
'Key store file should not be empty');
+            if (item.sslEnabled) {
+                if (!$common.isDefined(item.sslContextFactory)
+                    || $common.isEmptyString(item.sslContextFactory.keyStoreFilePath))
+                    return showPopoverMessage($scope.panels, 'sslConfiguration', 'keyStoreFilePath',
'Key store file should not be empty');
+
+                if ($common.isEmptyString(item.sslContextFactory.trustStoreFilePath) &&
$common.isEmptyArray(item.sslContextFactory.trustManagers))
+                    return showPopoverMessage($scope.panels, 'sslConfiguration', 'sslConfiguration-title',
'Trust storage file or managers should be configured');
+            }
 
             if (!item.swapSpaceSpi || !item.swapSpaceSpi.kind && item.caches) {
                 for (var i = 0; i < item.caches.length; i++) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/7db23996/modules/control-center-web/src/main/js/controllers/models/clusters.json
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/models/clusters.json b/modules/control-center-web/src/main/js/controllers/models/clusters.json
index 3556837..1b1c0a1 100644
--- a/modules/control-center-web/src/main/js/controllers/models/clusters.json
+++ b/modules/control-center-web/src/main/js/controllers/models/clusters.json
@@ -790,12 +790,26 @@
           ]
         },
         {
+          "label": "Trust managers",
+          "type": "table-simple",
+          "path": "sslContextFactory",
+          "model": "trustManagers",
+          "placeholder": "Trust manager",
+          "focusId": "trustManagers",
+          "addTip": "Add new trust manager.",
+          "removeTip": "Remove trust manager",
+          "hide": "!backupItem.sslEnabled",
+          "tableTip": [
+            "Pre-configured trust managers"
+          ]
+        },
+        {
           "label": "Trust store file",
           "id": "trustStoreFilePath",
           "type": "text",
           "path": "sslContextFactory",
           "model": "trustStoreFilePath",
-          "hide": "!backupItem.sslEnabled",
+          "hide": "!backupItem.sslEnabled || trustManagersConfigured()",
           "tip": [
             "Path to the trust store file"
           ]
@@ -808,24 +822,10 @@
           "model": "trustStoreType",
           "placeholder": "JKS",
           "items": "sslStoreType",
-          "hide": "!backupItem.sslEnabled",
+          "hide": "!backupItem.sslEnabled || trustManagersConfigured()",
           "tip": [
             "Trust store type used in context initialization"
           ]
-        },
-        {
-          "label": "Trust managers",
-          "type": "table-simple",
-          "path": "sslContextFactory",
-          "model": "trustManagers",
-          "placeholder": "Trust manager",
-          "focusId": "trustManagers",
-          "addTip": "Add new trust manager.",
-          "removeTip": "Remove trust manager",
-          "hide": "!backupItem.sslEnabled",
-          "tableTip": [
-            "Pre-configured trust managers"
-          ]
         }
       ]
     },

http://git-wip-us.apache.org/repos/asf/ignite/blob/7db23996/modules/control-center-web/src/main/js/helpers/common-utils.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/helpers/common-utils.js b/modules/control-center-web/src/main/js/helpers/common-utils.js
index e881f6a..7ea8885 100644
--- a/modules/control-center-web/src/main/js/helpers/common-utils.js
+++ b/modules/control-center-web/src/main/js/helpers/common-utils.js
@@ -31,12 +31,13 @@ $commonUtils.isDefined = function (v) {
  * @returns {boolean} 'true' if value defined and not empty string.
  */
 $commonUtils.isDefinedAndNotEmpty = function (v) {
-    var definded = $commonUtils.isDefined(v);
+    var defined = $commonUtils.isDefined(v);
 
-    if (definded && typeof(v) == 'string')
-        definded = v.length > 0;
+    if (defined && (typeof(v) == 'string' ||
+        Object.prototype.toString.call(v) === '[object Array]'))
+        defined = v.length > 0;
 
-    return definded;
+    return defined;
 };
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/7db23996/modules/control-center-web/src/main/js/routes/generator/generator-common.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-common.js b/modules/control-center-web/src/main/js/routes/generator/generator-common.js
index d07ee38..0e41557 100644
--- a/modules/control-center-web/src/main/js/routes/generator/generator-common.js
+++ b/modules/control-center-web/src/main/js/routes/generator/generator-common.js
@@ -318,7 +318,7 @@ $generatorCommon.TRANSACTION_CONFIGURATION = {
 };
 
 // SSL configuration code generation descriptor.
-$generatorCommon.SSL_CONFIGURATION_FACTORY = {
+$generatorCommon.SSL_CONFIGURATION_TRUST_FILE_FACTORY = {
     className: 'org.apache.ignite.ssl.SslContextFactory',
     fields: {
         keyAlgorithm: null,
@@ -327,8 +327,20 @@ $generatorCommon.SSL_CONFIGURATION_FACTORY = {
         keyStoreType: null,
         protocol: null,
         trustStoreFilePath: {type: 'path'},
-        keyTrustPassword: {type: 'raw'},
-        trustStoreType: null,
+        trustStorePassword: {type: 'raw'},
+        trustStoreType: null
+    }
+};
+
+// SSL configuration code generation descriptor.
+$generatorCommon.SSL_CONFIGURATION_TRUST_MANAGER_FACTORY = {
+    className: 'org.apache.ignite.ssl.SslContextFactory',
+    fields: {
+        keyAlgorithm: null,
+        keyStoreFilePath: {type: 'path'},
+        keyStorePassword: {type: 'raw'},
+        keyStoreType: null,
+        protocol: null,
         trustManagers: {type: 'array'}
     }
 };

http://git-wip-us.apache.org/repos/asf/ignite/blob/7db23996/modules/control-center-web/src/main/js/routes/generator/generator-java.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-java.js b/modules/control-center-web/src/main/js/routes/generator/generator-java.js
index bd3a24f..e9dbca8 100644
--- a/modules/control-center-web/src/main/js/routes/generator/generator-java.js
+++ b/modules/control-center-web/src/main/js/routes/generator/generator-java.js
@@ -1436,15 +1436,19 @@ $generatorJava.clusterSsl = function(cluster, res) {
         cluster.sslContextFactory.keyStorePassword =
             ($commonUtils.isDefinedAndNotEmpty(cluster.sslContextFactory.keyStoreFilePath))
? '_Key_Storage_Password_' : undefined;
 
-        cluster.sslContextFactory.keyTrustPassword = ($commonUtils.isDefinedAndNotEmpty(cluster.sslContextFactory.trustStoreFilePath))
?
+        cluster.sslContextFactory.trustStorePassword = ($commonUtils.isDefinedAndNotEmpty(cluster.sslContextFactory.trustStoreFilePath))
?
             '_Trust_Storage_Password_' : undefined;
 
+        var propsDesc = $commonUtils.isDefinedAndNotEmpty(cluster.sslContextFactory.trustManagers)
?
+            $generatorCommon.SSL_CONFIGURATION_TRUST_MANAGER_FACTORY.fields :
+            $generatorCommon.SSL_CONFIGURATION_TRUST_FILE_FACTORY.fields;
+
         $generatorJava.beanProperty(res, 'cfg', cluster.sslContextFactory, 'sslContextFactory',
'sslContextFactory',
-            'org.apache.ignite.ssl.SslContextFactory', $generatorCommon.SSL_CONFIGURATION_FACTORY.fields,
false);
+            'org.apache.ignite.ssl.SslContextFactory', propsDesc, false);
     }
 
     return res;
-}
+};
 
 /**
  * Function to generate java code for cluster configuration.

http://git-wip-us.apache.org/repos/asf/ignite/blob/7db23996/modules/control-center-web/src/main/js/routes/generator/generator-xml.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-xml.js b/modules/control-center-web/src/main/js/routes/generator/generator-xml.js
index a75ea9f..e4d2b13 100644
--- a/modules/control-center-web/src/main/js/routes/generator/generator-xml.js
+++ b/modules/control-center-web/src/main/js/routes/generator/generator-xml.js
@@ -568,14 +568,18 @@ $generatorXml.clusterSsl = function(cluster, res) {
         cluster.sslContextFactory.keyStorePassword =
             ($commonUtils.isDefinedAndNotEmpty(cluster.sslContextFactory.keyStoreFilePath))
? '${ssl.key.storage.password}' : undefined;
 
-        cluster.sslContextFactory.keyTrustPassword =
+        cluster.sslContextFactory.trustStorePassword =
             ($commonUtils.isDefinedAndNotEmpty(cluster.sslContextFactory.trustStoreFilePath))
? '${ssl.trust.storage.password}' : undefined;
 
-        $generatorXml.beanProperty(res, cluster.sslContextFactory, 'sslContextFactory', $generatorCommon.SSL_CONFIGURATION_FACTORY,
false);
+        var propsDesc = $commonUtils.isDefinedAndNotEmpty(cluster.sslContextFactory.trustManagers)
?
+            $generatorCommon.SSL_CONFIGURATION_TRUST_MANAGER_FACTORY :
+            $generatorCommon.SSL_CONFIGURATION_TRUST_FILE_FACTORY;
+
+        $generatorXml.beanProperty(res, cluster.sslContextFactory, 'sslContextFactory', propsDesc,
false);
     }
 
     return res;
-}
+};
 
 // Generate cache general group.
 $generatorXml.cacheGeneral = function(cache, res) {


Mime
View raw message