Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 135B418C62 for ; Wed, 24 Jun 2015 08:28:07 +0000 (UTC) Received: (qmail 81202 invoked by uid 500); 24 Jun 2015 08:28:07 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 81171 invoked by uid 500); 24 Jun 2015 08:28:07 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 81160 invoked by uid 99); 24 Jun 2015 08:28:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jun 2015 08:28:06 +0000 X-ASF-Spam-Status: No, hits=-2001.4 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 24 Jun 2015 08:25:55 +0000 Received: (qmail 80941 invoked by uid 99); 24 Jun 2015 08:27:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jun 2015 08:27:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id F1A38E33C9; Wed, 24 Jun 2015 08:27:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Date: Wed, 24 Jun 2015 08:27:42 -0000 Message-Id: <69c27b88263843579ad81c416f99ea92@git.apache.org> In-Reply-To: <1619bffa22224e7481c868d07d8f74ac@git.apache.org> References: <1619bffa22224e7481c868d07d8f74ac@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [02/10] incubator-ignite git commit: #IGNITE-GG-10449 marshal credentials in client discovery. X-Virus-Checked: Checked by ClamAV on apache.org #IGNITE-GG-10449 marshal credentials in client discovery. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a3d8e603 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a3d8e603 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a3d8e603 Branch: refs/heads/ignite-yardstick-client Commit: a3d8e603a5c9a7fbf3f81a7dd2aded2a8139f578 Parents: 1cc0000 Author: nikolay_tikhonov Authored: Mon Jun 22 11:33:53 2015 +0300 Committer: nikolay_tikhonov Committed: Mon Jun 22 11:33:53 2015 +0300 ---------------------------------------------------------------------- .../ignite/spi/discovery/tcp/ClientImpl.java | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a3d8e603/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java index e255e08..68e5dbd 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java @@ -362,6 +362,9 @@ class ClientImpl extends TcpDiscoveryImpl { long startTime = U.currentTimeMillis(); + // Marshal credentials for backward compatibility and security. + marshalCredentials(locNode); + while (true) { if (Thread.currentThread().isInterrupted()) throw new InterruptedException(); @@ -541,6 +544,26 @@ class ClientImpl extends TcpDiscoveryImpl { return null; } + /** + * Marshalls credentials with discovery SPI marshaller (will replace attribute value). + * + * @param node Node to marshall credentials for. + * @throws IgniteSpiException If marshalling failed. + */ + private void marshalCredentials(TcpDiscoveryNode node) throws IgniteSpiException { + try { + // Use security-unsafe getter. + Map attrs = new HashMap<>(node.getAttributes()); + + attrs.put(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS, + spi.marsh.marshal(attrs.get(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS))); + + node.setAttributes(attrs); + } + catch (IgniteCheckedException e) { + throw new IgniteSpiException("Failed to marshal node security credentials: " + node.id(), e); + } + } /** * @param topVer New topology version.