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:09 UTC
[19/50] [abbrv] incubator-geode git commit: secure unregisterInterest
secure unregisterInterest
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/2c090322
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/2c090322
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/2c090322
Branch: refs/heads/feature/GEODE-1571
Commit: 2c090322384bf1cef7e9bb539dae8cffb9d62229
Parents: 6a45ca0
Author: gmeilen <gr...@gmail.com>
Authored: Thu Jun 23 15:46:07 2016 -0700
Committer: gmeilen <gr...@gmail.com>
Committed: Thu Jun 23 15:46:07 2016 -0700
----------------------------------------------------------------------
.../sockets/command/UnregisterInterest.java | 6 ++-
...ntUnregisterInterestAuthDistributedTest.java | 41 ++++++++++++++++++++
2 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2c090322/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/UnregisterInterest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/UnregisterInterest.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/UnregisterInterest.java
index 39a462d..9161d6d 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/UnregisterInterest.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/UnregisterInterest.java
@@ -24,6 +24,7 @@ import com.gemstone.gemfire.internal.cache.tier.MessageType;
import com.gemstone.gemfire.internal.cache.tier.sockets.*;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.internal.security.AuthorizeRequest;
+import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
import com.gemstone.gemfire.security.NotAuthorizedException;
import com.gemstone.gemfire.cache.DynamicRegionFactory;
import com.gemstone.gemfire.cache.operations.UnregisterInterestOperationContext;
@@ -96,7 +97,9 @@ public class UnregisterInterest extends BaseCommand {
s, servConn);
servConn.setAsTrue(RESPONDED);
}
- else {
+
+ GeodeSecurityUtil.authorizeRegionRead(regionName, key.toString());
+
AuthorizeRequest authzRequest = servConn.getAuthzRequest();
if (authzRequest != null) {
// TODO SW: This is a workaround for DynamicRegionFactory
@@ -146,7 +149,6 @@ public class UnregisterInterest extends BaseCommand {
// DistributionStats.getStatTime() - start);
// bserverStats.incInt(destroyResponsesId, 1);
// }
- }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2c090322/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientUnregisterInterestAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientUnregisterInterestAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientUnregisterInterestAuthDistributedTest.java
new file mode 100644
index 0000000..2853a56
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientUnregisterInterestAuthDistributedTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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 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;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(DistributedTest.class)
+public class IntegratedClientUnregisterInterestAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest{
+ @Test
+ public void testRegisterInterest() throws InterruptedException {
+ // client2 connects to user as a user authorized to use AuthRegion region
+ AsyncInvocation ai1 = client2.invokeAsync(()->{
+ Cache cache = SecurityTestUtils.createCacheClient("authRegionUser", "1234567", serverPort, SecurityTestUtils.NO_EXCEPTION);
+ final Region region = cache.getRegion(SecurityTestUtils.REGION_NAME);
+ region.registerInterest("key3");
+ region.unregisterInterest("key3"); // DATA:READ:AuthRegion:key3;
+ });
+ ai1.join();
+ ai1.checkException();
+ }
+}