ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [20/46] incubator-ignite git commit: #gg-9809: Change check for security enable in GridDiscoveryManager.
Date Wed, 25 Feb 2015 00:36:43 GMT
#gg-9809: Change check for security enable in GridDiscoveryManager.


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

Branch: refs/heads/ignite-sql-tests
Commit: 7f06ab0d1dc2b6676c60472cee83c37a7ee80404
Parents: b387122
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Wed Feb 18 16:55:40 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Wed Feb 18 16:55:40 2015 +0300

----------------------------------------------------------------------
 .../discovery/GridDiscoveryManager.java         | 28 +++++++++++---------
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  7 +++--
 2 files changed, 19 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f06ab0d/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 1d39089..d5449ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -237,20 +237,24 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
 
         getSpi().setMetricsProvider(createMetricsProvider());
 
-        getSpi().setAuthenticator(new DiscoverySpiNodeAuthenticator() {
-            @Override public SecurityContext authenticateNode(ClusterNode node, GridSecurityCredentials
cred) {
-                try {
-                    return ctx.security().authenticateNode(node, cred);
-                }
-                catch (IgniteCheckedException e) {
-                    throw U.convertException(e);
+        if (ctx.security().enabled()) {
+            getSpi().setAuthenticator(new DiscoverySpiNodeAuthenticator() {
+                @Override
+                public SecurityContext authenticateNode(ClusterNode node, GridSecurityCredentials
cred) {
+                    try {
+                        return ctx.security().authenticateNode(node, cred);
+                    }
+                    catch (IgniteCheckedException e) {
+                        throw U.convertException(e);
+                    }
                 }
-            }
 
-            @Override public boolean isGlobalNodeAuthentication() {
-                return ctx.security().isGlobalNodeAuthentication();
-            }
-        });
+                @Override
+                public boolean isGlobalNodeAuthentication() {
+                    return ctx.security().isGlobalNodeAuthentication();
+                }
+            });
+        }
 
         getSpi().setListener(new DiscoverySpiListener() {
             @Override public void onDiscovery(int type, long topVer, ClusterNode node, Collection<ClusterNode>
topSnapshot,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f06ab0d/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 0d4fb41..b03df2e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -1269,7 +1269,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
                 if (log.isDebugEnabled())
                     log.debug("Join request message has not been sent (local node is the
first in the topology).");
 
-                if (((IgniteKernal)ignite).context().security().enabled()) {
+                if (nodeAuth != null) {
                     // Authenticate local node.
                     try {
                         SecurityContext subj = nodeAuth.authenticateNode(locNode, locCred);
@@ -3064,7 +3064,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
                     return;
                 }
 
-                if (((IgniteKernal)ignite).context().security().enabled()) {
+                if (nodeAuth != null) {
                     // Authenticate node first.
                     try {
                         GridSecurityCredentials cred = unmarshalCredentials(node);
@@ -3495,8 +3495,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
                     return;
                 }
 
-                if (!isLocalNodeCoordinator() && ((IgniteKernal)ignite).context().security().enabled()
&&
-                    nodeAuth.isGlobalNodeAuthentication()) {
+                if (!isLocalNodeCoordinator() && nodeAuth != null && nodeAuth.isGlobalNodeAuthentication())
{
                     boolean authFailed = true;
 
                     try {


Mime
View raw message