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 5581418661 for ; Tue, 23 Jun 2015 13:53:11 +0000 (UTC) Received: (qmail 37894 invoked by uid 500); 23 Jun 2015 13:53:11 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 37858 invoked by uid 500); 23 Jun 2015 13:53:11 -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 37845 invoked by uid 99); 23 Jun 2015 13:53:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Jun 2015 13:53:11 +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; Tue, 23 Jun 2015 13:50:58 +0000 Received: (qmail 36132 invoked by uid 99); 23 Jun 2015 13:52:45 -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; Tue, 23 Jun 2015 13:52:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 200BDE363A; Tue, 23 Jun 2015 13:52:45 +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: Tue, 23 Jun 2015 13:53:05 -0000 Message-Id: <40ffdf1fbda9475b932f92f7d55b1def@git.apache.org> In-Reply-To: <9ac96a394a1a40e2a9210d026a2562b9@git.apache.org> References: <9ac96a394a1a40e2a9210d026a2562b9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [22/33] 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-950 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.