You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2016/06/27 21:21:13 UTC
[23/50] [abbrv] incubator-geode git commit: RemoveAll
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 <kd...@pivotal.io>
Authored: Fri Jun 24 10:51:10 2016 -0700
Committer: Kevin J. Duling <kd...@pivotal.io>
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": [