Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 393DA200B3C for ; Mon, 27 Jun 2016 23:20:57 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 38299160A72; Mon, 27 Jun 2016 21:20:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 30BF8160A6E for ; Mon, 27 Jun 2016 23:20:56 +0200 (CEST) Received: (qmail 37118 invoked by uid 500); 27 Jun 2016 21:20:55 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 37108 invoked by uid 99); 27 Jun 2016 21:20:55 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jun 2016 21:20:55 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id D47A5CB743 for ; Mon, 27 Jun 2016 21:20:54 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.507 X-Spam-Level: X-Spam-Status: No, score=-4.507 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.287] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 4SgI32KSF8pl for ; Mon, 27 Jun 2016 21:20:53 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id CC0ED60E31 for ; Mon, 27 Jun 2016 21:20:52 +0000 (UTC) Received: (qmail 35943 invoked by uid 99); 27 Jun 2016 21:20:51 -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; Mon, 27 Jun 2016 21:20:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 909C4DFFF8; Mon, 27 Jun 2016 21:20:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jinmeiliao@apache.org To: commits@geode.incubator.apache.org Date: Mon, 27 Jun 2016 21:21:13 -0000 Message-Id: In-Reply-To: <24ba314e899c4361b472ed9567d1f7cb@git.apache.org> References: <24ba314e899c4361b472ed9567d1f7cb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [23/50] [abbrv] incubator-geode git commit: RemoveAll archived-at: Mon, 27 Jun 2016 21:20:57 -0000 RemoveAll Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/4ac886e6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/4ac886e6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/4ac886e6 Branch: refs/heads/feature/GEODE-1571 Commit: 4ac886e65543ff251872a945fbc7ff2558d43eea Parents: baea171 Author: Kevin J. Duling Authored: Fri Jun 24 10:51:10 2016 -0700 Committer: Kevin J. Duling Committed: Fri Jun 24 10:51:10 2016 -0700 ---------------------------------------------------------------------- .../cache/tier/sockets/command/RemoveAll.java | 5 +- ...ratedClientRemoveAllAuthDistributedTest.java | 56 ++++++++++++++++++++ .../internal/security/clientServer.json | 8 +++ 3 files changed, 67 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4ac886e6/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RemoveAll.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RemoveAll.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RemoveAll.java index ac546fc..6ed5d2f 100644 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RemoveAll.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RemoveAll.java @@ -23,7 +23,6 @@ package com.gemstone.gemfire.internal.cache.tier.sockets.command; import java.io.IOException; import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.Collection; import com.gemstone.gemfire.cache.DynamicRegionFactory; import com.gemstone.gemfire.cache.RegionDestroyedException; @@ -50,6 +49,7 @@ import com.gemstone.gemfire.internal.cache.versions.VersionTag; import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage; import com.gemstone.gemfire.internal.security.AuthorizeRequest; +import com.gemstone.gemfire.internal.security.GeodeSecurityUtil; import com.gemstone.gemfire.internal.util.Breadcrumbs; public class RemoveAll extends BaseCommand { @@ -210,7 +210,8 @@ public class RemoveAll extends BaseCommand { servConn.setRequestSpecificTimeout(timeout); } - + GeodeSecurityUtil.authorizeDataWrite(); + AuthorizeRequest authzRequest = servConn.getAuthzRequest(); if (authzRequest != null) { // TODO SW: This is to handle DynamicRegionFactory create http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4ac886e6/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRemoveAllAuthDistributedTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRemoveAllAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRemoveAllAuthDistributedTest.java new file mode 100644 index 0000000..527972c --- /dev/null +++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRemoveAllAuthDistributedTest.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.gemstone.gemfire.security; + +import static org.junit.Assert.assertFalse; + +import java.util.Arrays; + +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import com.gemstone.gemfire.cache.Cache; +import com.gemstone.gemfire.cache.Region; +import com.gemstone.gemfire.test.dunit.AsyncInvocation; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; + +@Category(DistributedTest.class) +public class IntegratedClientRemoveAllAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest { + + @Test + public void testRemoveAll() throws InterruptedException { + + AsyncInvocation ai1 = client1.invokeAsync(() -> { + Cache cache = SecurityTestUtils.createCacheClient("dataReader", "1234567", serverPort, SecurityTestUtils.NO_EXCEPTION); + final Region region = cache.getRegion(SecurityTestUtils.REGION_NAME); + assertNotAuthorized(() -> region.removeAll(Arrays.asList("key1", "key2", "key3", "key4")), "DATA:WRITE"); + }); + + AsyncInvocation ai2 = client2.invokeAsync(() -> { + Cache cache = SecurityTestUtils.createCacheClient("dataUser", "1234567", serverPort, SecurityTestUtils.NO_EXCEPTION); + final Region region = cache.getRegion(SecurityTestUtils.REGION_NAME); + region.removeAll(Arrays.asList("key1", "key2", "key3", "key4")); + assertFalse(region.containsKey("key1")); + assertFalse(region.containsKeyOnServer("key1")); + }); + ai1.join(); + ai2.join(); + ai1.checkException(); + ai2.checkException(); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4ac886e6/geode-core/src/test/resources/com/gemstone/gemfire/management/internal/security/clientServer.json ---------------------------------------------------------------------- diff --git a/geode-core/src/test/resources/com/gemstone/gemfire/management/internal/security/clientServer.json b/geode-core/src/test/resources/com/gemstone/gemfire/management/internal/security/clientServer.json index c659709..8dedd78 100644 --- a/geode-core/src/test/resources/com/gemstone/gemfire/management/internal/security/clientServer.json +++ b/geode-core/src/test/resources/com/gemstone/gemfire/management/internal/security/clientServer.json @@ -136,6 +136,14 @@ ] }, { + "name": "dataUser", + "password": "1234567", + "roles": [ + "data-read", + "data-write" + ] + }, + { "name":"authRegionUser", "password": "1234567", "roles": [