geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [28/50] [abbrv] incubator-geode git commit: GEODE-1712: introduce SecurityService interface for mocking
Date Wed, 10 Aug 2016 19:41:14 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/DestroyRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/DestroyRegion.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/DestroyRegion.java
index 0622cc2..22dd307 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/DestroyRegion.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/DestroyRegion.java
@@ -14,13 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/**
- *
- */
+
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.security.Security;
 
 import com.gemstone.gemfire.cache.operations.RegionDestroyOperationContext;
 import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException;
@@ -38,7 +37,7 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 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.security.SecurityService;
 
 public class DestroyRegion extends BaseCommand {
 
@@ -48,9 +47,6 @@ public class DestroyRegion extends BaseCommand {
     return singleton;
   }
 
-  private DestroyRegion() {
-  }
-
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException, InterruptedException {
     Part regionNamePart = null, callbackArgPart = null;
@@ -58,7 +54,6 @@ public class DestroyRegion extends BaseCommand {
     Object callbackArg = null;
     Part eventPart = null;
     StringBuffer errMessage = new StringBuffer();
-    CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     CacheServerStats stats = servConn.getCacheServerStats();
     servConn.setAsTrue(REQUIRES_RESPONSE);
 
@@ -107,7 +102,7 @@ public class DestroyRegion extends BaseCommand {
       return;
     }
 
-    LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
     if (region == null) {
       String reason = LocalizedStrings.DestroyRegion_REGION_WAS_NOT_FOUND_DURING_DESTROY_REGION_REQUEST.toLocalizedString();
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -115,9 +110,6 @@ public class DestroyRegion extends BaseCommand {
       return;
     }
 
-    // user needs to have data:manage on all regions in order to destory a particular region
-    GeodeSecurityUtil.authorizeDataManage();
-
     // Destroy the region
     ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
     long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
@@ -125,6 +117,9 @@ public class DestroyRegion extends BaseCommand {
     EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
 
     try {
+      // user needs to have data:manage on all regions in order to destory a particular region
+      this.securityService.authorizeDataManage();
+
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();
       if (authzRequest != null) {
         RegionDestroyOperationContext destroyContext = authzRequest.destroyRegionAuthorize(regionName, callbackArg);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction.java
index 1ad2c42..9480b4b 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction.java
@@ -14,9 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/**
- * 
- */
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -53,7 +50,6 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 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;
 
 /**
  * This is the base command which read the parts for the
@@ -71,9 +67,6 @@ public class ExecuteFunction extends BaseCommand {
     return singleton;
   }
 
-  private ExecuteFunction() {
-  }
-
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start)
       throws IOException {
@@ -130,10 +123,10 @@ public class ExecuteFunction extends BaseCommand {
           functionObject = (Function)function;
         }
 
-        GeodeSecurityUtil.authorizeDataWrite();
+        FunctionStats stats = FunctionStats.getFunctionStats(functionObject.getId());
+
+        this.securityService.authorizeDataWrite();
 
-        FunctionStats stats = FunctionStats.getFunctionStats(functionObject.getId(), null);
-        
         // check if the caller is authorized to do this operation on server
         AuthorizeRequest authzRequest = servConn.getAuthzRequest();
         ExecuteFunctionOperationContext executeContext = null;
@@ -145,9 +138,9 @@ public class ExecuteFunction extends BaseCommand {
         m.setTransactionId(msg.getTransactionId());
         ResultSender resultSender = new ServerToClientFunctionResultSender(m,
             MessageType.EXECUTE_FUNCTION_RESULT, servConn, functionObject, executeContext);
-        
-        InternalDistributedMember localVM = InternalDistributedSystem
-            .getAnyInstance().getDistributedMember();
+
+        InternalDistributedMember localVM = (InternalDistributedMember)servConn.getCache().getDistributedSystem().getDistributedMember();
+
         FunctionContext context = null;
 
         if (memberMappedArg != null) {
@@ -168,7 +161,7 @@ public class ExecuteFunction extends BaseCommand {
           if(logger.isDebugEnabled()){
             logger.debug("Executing Function on Server: " + servConn.toString() + "with context :" + context.toString());
           }
-          GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+          GemFireCacheImpl cache = (GemFireCacheImpl)servConn.getCache();
           HeapMemoryMonitor hmm = ((InternalResourceManager) cache.getResourceManager()).getHeapMonitor();
           if (functionObject.optimizeForWrite() && cache != null &&
               hmm.getState().isCritical() &&

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction65.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction65.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction65.java
index fdd33ac..ac458df 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction65.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction65.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -52,7 +51,8 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 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.security.IntegratedSecurityService;
+import com.gemstone.gemfire.internal.security.SecurityService;
 
 /**
  * @since GemFire 6.5
@@ -65,7 +65,7 @@ public class ExecuteFunction65 extends BaseCommand {
     return singleton;
   }
 
-  private ExecuteFunction65() {
+  ExecuteFunction65() {
   }
 
   @Override
@@ -146,9 +146,10 @@ public class ExecuteFunction65 extends BaseCommand {
         functionObject = (Function) function;
       }
 
-      GeodeSecurityUtil.authorizeDataWrite();
+      FunctionStats stats = FunctionStats.getFunctionStats(functionObject.getId());
+
+      this.securityService.authorizeDataWrite();
 
-      FunctionStats stats = FunctionStats.getFunctionStats(functionObject.getId(), null);
       // check if the caller is authorized to do this operation on server
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();
       ExecuteFunctionOperationContext executeContext = null;
@@ -159,7 +160,7 @@ public class ExecuteFunction65 extends BaseCommand {
       m.setTransactionId(msg.getTransactionId());
       ResultSender resultSender = new ServerToClientFunctionResultSender65(m, MessageType.EXECUTE_FUNCTION_RESULT, servConn, functionObject, executeContext);
 
-      InternalDistributedMember localVM = InternalDistributedSystem.getAnyInstance().getDistributedMember();
+      InternalDistributedMember localVM = (InternalDistributedMember)servConn.getCache().getDistributedSystem().getDistributedMember();
       FunctionContext context = null;
 
       if (memberMappedArg != null) {
@@ -176,7 +177,7 @@ public class ExecuteFunction65 extends BaseCommand {
         if (logger.isDebugEnabled()) {
           logger.debug("Executing Function on Server: {} with context: {}", servConn, context);
         }
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+        GemFireCacheImpl cache = (GemFireCacheImpl)servConn.getCache();
         HeapMemoryMonitor hmm = ((InternalResourceManager) cache.getResourceManager()).getHeapMonitor();
         if (functionObject.optimizeForWrite() && cache != null &&
             hmm.getState().isCritical() &&
@@ -198,6 +199,7 @@ public class ExecuteFunction65 extends BaseCommand {
         stats.endFunctionExecution(startExecution, functionObject.hasResult());
       } catch (FunctionException functionException) {
         stats.endFunctionExecutionWithException(functionObject.hasResult());
+
         throw functionException;
       } catch (Exception exception) {
         stats.endFunctionExecutionWithException(functionObject.hasResult());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction66.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction66.java
index 5ed8e00..fef58b2 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction66.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteFunction66.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -62,7 +61,6 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 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;
 
 /**
  * @since GemFire 6.6
@@ -87,7 +85,7 @@ public class ExecuteFunction66 extends BaseCommand {
     return singleton;
   }
 
-  protected ExecuteFunction66() {
+  ExecuteFunction66() {
   }
 
   @Override
@@ -186,9 +184,10 @@ public class ExecuteFunction66 extends BaseCommand {
         functionObject = (Function) function;
       }
 
-      GeodeSecurityUtil.authorizeDataWrite();
+      FunctionStats stats = FunctionStats.getFunctionStats(functionObject.getId());
+
+      this.securityService.authorizeDataWrite();
 
-      FunctionStats stats = FunctionStats.getFunctionStats(functionObject.getId(), null);
       // check if the caller is authorized to do this operation on server
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();
       ExecuteFunctionOperationContext executeContext = null;
@@ -199,7 +198,7 @@ public class ExecuteFunction66 extends BaseCommand {
       m.setTransactionId(msg.getTransactionId());
       ServerToClientFunctionResultSender resultSender = new ServerToClientFunctionResultSender65(m, MessageType.EXECUTE_FUNCTION_RESULT, servConn, functionObject, executeContext);
 
-      InternalDistributedMember localVM = InternalDistributedSystem.getAnyInstance().getDistributedMember();
+      InternalDistributedMember localVM =  (InternalDistributedMember)servConn.getCache().getDistributedSystem().getDistributedMember();
       FunctionContext context = null;
 
       if (memberMappedArg != null) {
@@ -214,7 +213,7 @@ public class ExecuteFunction66 extends BaseCommand {
         if (logger.isDebugEnabled()) {
           logger.debug("Executing Function on Server: {} with context: {}", servConn, context);
         }
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+        GemFireCacheImpl cache = (GemFireCacheImpl)servConn.getCache();
         HeapMemoryMonitor hmm = ((InternalResourceManager) cache.getResourceManager()).getHeapMonitor();
         if (functionObject.optimizeForWrite() && cache != null && hmm.getState()
                                                                      .isCritical() && !MemoryThresholds.isLowMemoryExceptionDisabled()) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction.java
index 7f37688..1b184a0 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -46,7 +45,8 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 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.security.IntegratedSecurityService;
+import com.gemstone.gemfire.internal.security.SecurityService;
 
 /**
  * This is the base command which reads the parts for the
@@ -152,7 +152,7 @@ public class ExecuteRegionFunction extends BaseCommand {
         functionObject = (Function) function;
       }
 
-      GeodeSecurityUtil.authorizeDataWrite();
+      this.securityService.authorizeDataWrite();
 
       // check if the caller is authorized to do this operation on server
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();
@@ -169,7 +169,6 @@ public class ExecuteRegionFunction extends BaseCommand {
       m.setTransactionId(msg.getTransactionId());
       resultSender = new ServerToClientFunctionResultSender(m, MessageType.EXECUTE_REGION_FUNCTION_RESULT, servConn, functionObject, executeContext);
 
-
       if (execution instanceof PartitionedRegionFunctionExecutor) {
         execution = new PartitionedRegionFunctionExecutor((PartitionedRegion) region, filter, args, memberMappedArg, resultSender, null, false);
       } else {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction65.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction65.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction65.java
index 652c74e..b5cfeb9 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction65.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction65.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -48,7 +47,8 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 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.security.IntegratedSecurityService;
+import com.gemstone.gemfire.internal.security.SecurityService;
 
 /**
  * @since GemFire 6.5
@@ -182,7 +182,7 @@ public class ExecuteRegionFunction65 extends BaseCommand {
         functionObject = (Function) function;
       }
 
-      GeodeSecurityUtil.authorizeDataWrite();
+      this.securityService.authorizeDataWrite();
 
       // check if the caller is authorized to do this operation on server
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java
index 7c81b8c..4dfedc5 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -52,7 +51,8 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 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.security.IntegratedSecurityService;
+import com.gemstone.gemfire.internal.security.SecurityService;
 
 /**
  * @since GemFire 6.6
@@ -199,7 +199,7 @@ public class ExecuteRegionFunction66 extends BaseCommand {
         functionObject = (Function) function;
       }
 
-      GeodeSecurityUtil.authorizeDataWrite();
+      this.securityService.authorizeDataWrite();
 
       // check if the caller is authorized to do this operation on server
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java
index fcbe47d..4b12c3e 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -49,7 +48,8 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 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.security.IntegratedSecurityService;
+import com.gemstone.gemfire.internal.security.SecurityService;
 
 /**
  * @since GemFire 6.5
@@ -200,7 +200,7 @@ public class ExecuteRegionFunctionSingleHop extends BaseCommand {
         functionObject = (Function) function;
       }
 
-      GeodeSecurityUtil.authorizeDataWrite();
+      this.securityService.authorizeDataWrite();
 
       // check if the caller is authorized to do this operation on server
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Get70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Get70.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Get70.java
index 54227fb..9e5df16 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Get70.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Get70.java
@@ -14,9 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/**
- * 
- */
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -48,7 +45,6 @@ import com.gemstone.gemfire.internal.offheap.annotations.Retained;
 import com.gemstone.gemfire.internal.offheap.annotations.Unretained;
 import com.gemstone.gemfire.internal.security.AuthorizeRequest;
 import com.gemstone.gemfire.internal.security.AuthorizeRequestPP;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 import com.gemstone.gemfire.security.NotAuthorizedException;
 
 public class Get70 extends BaseCommand {
@@ -59,9 +55,6 @@ public class Get70 extends BaseCommand {
     return singleton;
   }
 
-  protected Get70() {
-  }
-  
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long startparam)
       throws IOException {
@@ -144,10 +137,7 @@ public class Get70 extends BaseCommand {
       return;
     }
 
-    // for integrated security
-    GeodeSecurityUtil.authorizeRegionRead(regionName, key.toString());
-
-    Region region = crHelper.getRegion(regionName);
+    Region region = servConn.getCache().getRegion(regionName);
     if (region == null) {
       String reason = LocalizedStrings.Request__0_WAS_NOT_FOUND_DURING_GET_REQUEST.toLocalizedString(regionName);
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -157,6 +147,9 @@ public class Get70 extends BaseCommand {
 
     GetOperationContext getContext = null;
     try {
+      // for integrated security
+      this.securityService.authorizeRegionRead(regionName, key.toString());
+
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();
       if (authzRequest != null) {
         getContext = authzRequest
@@ -217,7 +210,7 @@ public class Get70 extends BaseCommand {
       }
 
       // post process
-      data = GeodeSecurityUtil.postProcess(regionName, key, data, entry.isObject);
+      data = this.securityService.postProcess(regionName, key, data, entry.isObject);
 
       long oldStart = start;
       start = DistributionStats.getStatTime();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll.java
index ea860d3..e5341e9 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -24,7 +23,6 @@ import java.util.Set;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.operations.GetOperationContext;
 import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.internal.cache.tier.CachedRegionHelper;
 import com.gemstone.gemfire.internal.cache.tier.Command;
 import com.gemstone.gemfire.internal.cache.tier.MessageType;
 import com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand;
@@ -37,7 +35,6 @@ 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.AuthorizeRequestPP;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 import com.gemstone.gemfire.security.NotAuthorizedException;
 
 public class GetAll extends BaseCommand {
@@ -48,15 +45,11 @@ public class GetAll extends BaseCommand {
     return singleton;
   }
 
-  private GetAll() {
-  }
-
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException, InterruptedException {
     Part regionNamePart = null, keysPart = null;
     String regionName = null;
     Object[] keys = null;
-    CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     servConn.setAsTrue(REQUIRES_RESPONSE);
     servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
 
@@ -109,7 +102,7 @@ public class GetAll extends BaseCommand {
       return;
     }
 
-    LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
     if (region == null) {
       String reason = " was not found during getAll request";
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -197,7 +190,7 @@ public class GetAll extends BaseCommand {
       }
 
       try {
-        GeodeSecurityUtil.authorizeRegionRead(regionName, key.toString());
+        this.securityService.authorizeRegionRead(regionName, key.toString());
       } catch (NotAuthorizedException ex) {
         logger.warn(LocalizedMessage.create(LocalizedStrings.GetAll_0_CAUGHT_THE_FOLLOWING_EXCEPTION_ATTEMPTING_TO_GET_VALUE_FOR_KEY_1, new Object[] {
           servConn.getName(),
@@ -242,7 +235,7 @@ public class GetAll extends BaseCommand {
       }
 
       // post process
-      value = GeodeSecurityUtil.postProcess(regionName, key, value, isObject);
+      value = this.securityService.postProcess(regionName, key, value, isObject);
 
       if (logger.isDebugEnabled()) {
         logger.debug("{}: Returning value for key={}: {}", servConn.getName(), key, value);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll651.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll651.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll651.java
index d696bf6..8449c3c 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll651.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll651.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -37,7 +36,6 @@ 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.AuthorizeRequestPP;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 import com.gemstone.gemfire.security.NotAuthorizedException;
 
 public class GetAll651 extends BaseCommand {
@@ -48,15 +46,11 @@ public class GetAll651 extends BaseCommand {
     return singleton;
   }
 
-  protected GetAll651() {
-  }
-
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException, InterruptedException {
     Part regionNamePart = null, keysPart = null;
     String regionName = null;
     Object[] keys = null;
-    CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     servConn.setAsTrue(REQUIRES_RESPONSE);
     servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
 
@@ -107,7 +101,7 @@ public class GetAll651 extends BaseCommand {
       return;
     }
 
-    LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
     if (region == null) {
       String reason = " was not found during getAll request";
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -196,7 +190,7 @@ public class GetAll651 extends BaseCommand {
       }
 
       try {
-        GeodeSecurityUtil.authorizeRegionRead(regionName, key.toString());
+        this.securityService.authorizeRegionRead(regionName, key.toString());
       } catch (NotAuthorizedException ex) {
         logger.warn(LocalizedMessage.create(LocalizedStrings.GetAll_0_CAUGHT_THE_FOLLOWING_EXCEPTION_ATTEMPTING_TO_GET_VALUE_FOR_KEY_1, new Object[] {
           servConn.getName(),
@@ -241,8 +235,7 @@ public class GetAll651 extends BaseCommand {
           continue;
         }
       }
-
-      value = GeodeSecurityUtil.postProcess(regionName, key, value, isObject);
+      value = this.securityService.postProcess(regionName, key, value, isObject);
 
       if (isDebugEnabled) {
         logger.debug("{}: Returning value for key={}: {}", servConn.getName(), key, value);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll70.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll70.java
index 673a061..955bd85 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll70.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAll70.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -43,7 +42,7 @@ import com.gemstone.gemfire.internal.offheap.OffHeapHelper;
 import com.gemstone.gemfire.internal.offheap.annotations.Retained;
 import com.gemstone.gemfire.internal.security.AuthorizeRequest;
 import com.gemstone.gemfire.internal.security.AuthorizeRequestPP;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
+import com.gemstone.gemfire.internal.security.SecurityService;
 import com.gemstone.gemfire.security.NotAuthorizedException;
 
 public class GetAll70 extends BaseCommand {
@@ -54,19 +53,11 @@ public class GetAll70 extends BaseCommand {
     return singleton;
   }
 
-  /**
-   * client wants values to be serialized as byte arrays, not objects
-   */
-  // private boolean requestSerializedValues;
-  protected GetAll70() {
-  }
-
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException, InterruptedException {
     Part regionNamePart = null, keysPart = null;
     String regionName = null;
     Object[] keys = null;
-    CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     servConn.setAsTrue(REQUIRES_RESPONSE);
     servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
     int partIdx = 0;
@@ -120,7 +111,7 @@ public class GetAll70 extends BaseCommand {
       return;
     }
 
-    LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
     if (region == null) {
       String reason = " was not found during getAll request";
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -221,7 +212,7 @@ public class GetAll70 extends BaseCommand {
         }
 
         try {
-          GeodeSecurityUtil.authorizeRegionRead(regionName, key.toString());
+          this.securityService.authorizeRegionRead(regionName, key.toString());
         } catch (NotAuthorizedException ex) {
           logger.warn(LocalizedMessage.create(LocalizedStrings.GetAll_0_CAUGHT_THE_FOLLOWING_EXCEPTION_ATTEMPTING_TO_GET_VALUE_FOR_KEY_1, new Object[] {
             servConn.getName(),
@@ -272,7 +263,7 @@ public class GetAll70 extends BaseCommand {
             }
           }
 
-          data = GeodeSecurityUtil.postProcess(regionName, key, data, entry.isObject);
+          data = this.securityService.postProcess(regionName, key, data, entry.isObject);
 
           // Add the entry to the list that will be returned to the client
           if (keyNotPresent) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAllWithCallback.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAllWithCallback.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAllWithCallback.java
index 42a871a..5037c26 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAllWithCallback.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetAllWithCallback.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -43,7 +42,6 @@ import com.gemstone.gemfire.internal.offheap.OffHeapHelper;
 import com.gemstone.gemfire.internal.offheap.annotations.Retained;
 import com.gemstone.gemfire.internal.security.AuthorizeRequest;
 import com.gemstone.gemfire.internal.security.AuthorizeRequestPP;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 import com.gemstone.gemfire.security.NotAuthorizedException;
 
 /**
@@ -60,9 +58,6 @@ public class GetAllWithCallback extends BaseCommand {
     return singleton;
   }
 
-  protected GetAllWithCallback() {
-  }
-
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start)
           throws IOException, InterruptedException {
@@ -70,7 +65,6 @@ public class GetAllWithCallback extends BaseCommand {
     String regionName = null;
     Object[] keys = null;
     Object callback = null;
-    CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     servConn.setAsTrue(REQUIRES_RESPONSE);
     servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
     int partIdx = 0;
@@ -133,7 +127,7 @@ public class GetAllWithCallback extends BaseCommand {
       servConn.setAsTrue(RESPONDED);
       return;
     }
-    LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
     if (region == null) {
       String reason = " was not found during getAll request";
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -205,7 +199,7 @@ public class GetAllWithCallback extends BaseCommand {
       }
 
       try {
-        GeodeSecurityUtil.authorizeRegionRead(regionName, key.toString());
+        this.securityService.authorizeRegionRead(regionName, key.toString());
       } catch (NotAuthorizedException ex) {
         logger.warn(LocalizedMessage.create(LocalizedStrings.GetAll_0_CAUGHT_THE_FOLLOWING_EXCEPTION_ATTEMPTING_TO_GET_VALUE_FOR_KEY_1, new Object[] {
           servConn.getName(),

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java
index 0873635..ab4b4ff 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java
@@ -14,20 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
-import java.util.Set;
 
 import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.FixedPartitionAttributes;
 import com.gemstone.gemfire.cache.PartitionResolver;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.internal.GetClientPartitionAttributesOp;
 import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-import com.gemstone.gemfire.internal.cache.PartitionedRegionHelper;
-import com.gemstone.gemfire.internal.cache.tier.CachedRegionHelper;
 import com.gemstone.gemfire.internal.cache.tier.Command;
 import com.gemstone.gemfire.internal.cache.tier.MessageType;
 import com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand;
@@ -35,7 +30,6 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.Message;
 import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 
 /**
  * {@link Command} for {@link GetClientPartitionAttributesOp} operation
@@ -49,16 +43,12 @@ public class GetClientPartitionAttributesCommand extends BaseCommand {
     return singleton;
   }
 
-  private GetClientPartitionAttributesCommand() {
-  }
-
   @SuppressWarnings("unchecked")
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start)
     throws IOException, ClassNotFoundException, InterruptedException
   {
     String regionFullPath = null;
-    CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     regionFullPath = msg.getPart(0).getString();
     String errMessage = "";
     if (regionFullPath == null) {
@@ -71,7 +61,7 @@ public class GetClientPartitionAttributesCommand extends BaseCommand {
       servConn.setAsTrue(RESPONDED);
       return;
     }
-    Region region = crHelper.getRegion(regionFullPath);
+    Region region = servConn.getCache().getRegion(regionFullPath);
     if (region == null) {
       logger.warn(LocalizedMessage
         .create(LocalizedStrings.GetClientPartitionAttributes_REGION_NOT_FOUND_FOR_SPECIFIED_REGION_PATH,
@@ -87,7 +77,6 @@ public class GetClientPartitionAttributesCommand extends BaseCommand {
     }
 
     try {
-      GeodeSecurityUtil.authorizeClusterRead();
       Message responseMsg = servConn.getResponseMessage();
       responseMsg.setTransactionId(msg.getTransactionId());
       responseMsg

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java
index 72cdcf2..0776a9d 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -27,7 +26,6 @@ import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.internal.GetClientPartitionAttributesOp;
 import com.gemstone.gemfire.internal.cache.PartitionedRegion;
 import com.gemstone.gemfire.internal.cache.PartitionedRegionHelper;
-import com.gemstone.gemfire.internal.cache.tier.CachedRegionHelper;
 import com.gemstone.gemfire.internal.cache.tier.Command;
 import com.gemstone.gemfire.internal.cache.tier.MessageType;
 import com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand;
@@ -35,7 +33,6 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.Message;
 import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 
 /**
  * {@link Command} for {@link GetClientPartitionAttributesOp} operation for 6.6
@@ -50,7 +47,7 @@ public class GetClientPartitionAttributesCommand66 extends BaseCommand {
     return singleton;
   }
 
-  private GetClientPartitionAttributesCommand66() {
+  GetClientPartitionAttributesCommand66() {
   }
 
   @SuppressWarnings("unchecked")
@@ -59,7 +56,6 @@ public class GetClientPartitionAttributesCommand66 extends BaseCommand {
     throws IOException, ClassNotFoundException, InterruptedException
   {
     String regionFullPath = null;
-    CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     regionFullPath = msg.getPart(0).getString();
     String errMessage = "";
     if (regionFullPath == null) {
@@ -72,7 +68,7 @@ public class GetClientPartitionAttributesCommand66 extends BaseCommand {
       servConn.setAsTrue(RESPONDED);
       return;
     }
-    Region region = crHelper.getRegion(regionFullPath);
+    Region region = servConn.getCache().getRegion(regionFullPath);
     if (region == null) {
       logger.warn(LocalizedMessage
         .create(LocalizedStrings.GetClientPartitionAttributes_REGION_NOT_FOUND_FOR_SPECIFIED_REGION_PATH,
@@ -87,7 +83,6 @@ public class GetClientPartitionAttributesCommand66 extends BaseCommand {
     }
 
     try {
-      GeodeSecurityUtil.authorizeClusterRead();
       Message responseMsg = servConn.getResponseMessage();
       responseMsg.setTransactionId(msg.getTransactionId());
       responseMsg

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetEntry70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetEntry70.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetEntry70.java
index 715da7f..d975f1b 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetEntry70.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetEntry70.java
@@ -24,7 +24,6 @@ import com.gemstone.gemfire.internal.cache.NonLocalRegionEntry;
 import com.gemstone.gemfire.internal.cache.tier.Command;
 import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 import com.gemstone.gemfire.internal.cache.versions.VersionTag;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 
 /**
  * getEntry(key) operation performed on server.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetFunctionAttribute.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetFunctionAttribute.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetFunctionAttribute.java
index 1cf1ea4..cc5cec8 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetFunctionAttribute.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetFunctionAttribute.java
@@ -26,7 +26,6 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand;
 import com.gemstone.gemfire.internal.cache.tier.sockets.Message;
 import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 
 public class GetFunctionAttribute extends BaseCommand {
 
@@ -36,9 +35,6 @@ public class GetFunctionAttribute extends BaseCommand {
     return singleton;
   }
 
-  private GetFunctionAttribute() {
-  }
-
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start)
       throws IOException {
@@ -62,7 +58,7 @@ public class GetFunctionAttribute extends BaseCommand {
       return;
     }
 
-    GeodeSecurityUtil.authorizeClusterRead();
+    this.securityService.authorizeClusterRead();
 
     byte[] functionAttributes = new byte[3];
     functionAttributes[0] = (byte)(function.hasResult() ? 1 : 0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Invalidate.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Invalidate.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Invalidate.java
index 44a6f7e..166b11a 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Invalidate.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Invalidate.java
@@ -14,9 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/**
- *
- */
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -42,18 +39,13 @@ 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;
 import com.gemstone.gemfire.security.GemFireSecurityException;
 
-
 public class Invalidate extends BaseCommand {
 
   private final static Invalidate singleton = new Invalidate();
 
-  Invalidate() {
-  }
-
   public static Command getCommand() {
     return singleton;
   }
@@ -65,7 +57,6 @@ public class Invalidate extends BaseCommand {
     Object callbackArg = null, key = null;
     Part eventPart = null;
     StringBuffer errMessage = new StringBuffer();
-    CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     CacheServerStats stats = servConn.getCacheServerStats();
     servConn.setAsTrue(REQUIRES_RESPONSE);
 
@@ -116,7 +107,7 @@ public class Invalidate extends BaseCommand {
       servConn.setAsTrue(RESPONDED);
       return;
     }
-    LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
     if (region == null) {
       String reason = LocalizedStrings.BaseCommand__0_WAS_NOT_FOUND_DURING_1_REQUEST.toLocalizedString(regionName, "invalidate");
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -133,10 +124,10 @@ public class Invalidate extends BaseCommand {
 
     VersionTag tag = null;
 
-    // for integrated security
-    GeodeSecurityUtil.authorizeRegionWrite(regionName, key.toString());
-
     try {
+      // for integrated security
+      this.securityService.authorizeRegionWrite(regionName, key.toString());
+
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();
       if (authzRequest != null) {
         InvalidateOperationContext invalidateContext = authzRequest.invalidateAuthorize(regionName, key, callbackArg);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Invalidate70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Invalidate70.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Invalidate70.java
index 7ced9c8..6200438 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Invalidate70.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Invalidate70.java
@@ -14,9 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/**
- * 
- */
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import com.gemstone.gemfire.cache.client.internal.DestroyOp;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/KeySet.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/KeySet.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/KeySet.java
index 0163be7..ca35b96 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/KeySet.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/KeySet.java
@@ -40,10 +40,8 @@ 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.AuthorizeRequestPP;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 import com.gemstone.gemfire.security.NotAuthorizedException;
 
-
 public class KeySet extends BaseCommand {
 
   private final static KeySet singleton = new KeySet();
@@ -52,14 +50,10 @@ public class KeySet extends BaseCommand {
     return singleton;
   }
 
-  private KeySet() {
-  }
-
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException, InterruptedException {
     Part regionNamePart = null;
     String regionName = null;
-    CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     servConn.setAsTrue(REQUIRES_RESPONSE);
     servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
 
@@ -88,7 +82,7 @@ public class KeySet extends BaseCommand {
       return;
     }
 
-    LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
     if (region == null) {
       String reason = LocalizedStrings.KeySet__0_WAS_NOT_FOUND_DURING_KEY_SET_REQUEST.toLocalizedString(regionName);
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -96,7 +90,13 @@ public class KeySet extends BaseCommand {
       return;
     }
 
-    GeodeSecurityUtil.authorizeRegionRead(regionName);
+    try {
+      this.securityService.authorizeRegionRead(regionName);
+    } catch (NotAuthorizedException ex) {
+      writeChunkedException(msg, ex, false, servConn);
+      servConn.setAsTrue(RESPONDED);
+      return;
+    }
 
     KeySetOperationContext keySetContext = null;
     AuthorizeRequest authzRequest = servConn.getAuthzRequest();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put.java
index 54c4a6c..2699390 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put.java
@@ -14,9 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/**
- *
- */
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -42,7 +39,6 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 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.security.GemFireSecurityException;
 
 public class Put extends BaseCommand {
@@ -53,8 +49,6 @@ public class Put extends BaseCommand {
     return singleton;
   }
 
-  private Put() {
-  }
 
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException, InterruptedException {
@@ -134,7 +128,7 @@ public class Put extends BaseCommand {
       return;
     }
 
-    LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
     if (region == null) {
       String reason = LocalizedStrings.Put_REGION_WAS_NOT_FOUND_DURING_PUT_REQUEST.toLocalizedString();
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -154,8 +148,6 @@ public class Put extends BaseCommand {
       return;
     }
 
-    GeodeSecurityUtil.authorizeRegionWrite(regionName, key.toString());
-
     ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
     long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
     long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
@@ -164,6 +156,9 @@ public class Put extends BaseCommand {
     try {
       byte[] value = valuePart.getSerializedForm();
       boolean isObject = valuePart.isObject();
+
+      this.securityService.authorizeRegionWrite(regionName, key.toString());
+
       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/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put61.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put61.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put61.java
index 48e2a01..9b64256 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put61.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put61.java
@@ -43,7 +43,6 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 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.security.GemFireSecurityException;
 
 /**
@@ -57,9 +56,6 @@ public class Put61 extends BaseCommand {
     return singleton;
   }
 
-  private Put61() {
-  }
-
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long p_start)
     throws IOException, InterruptedException {
@@ -152,7 +148,7 @@ public class Put61 extends BaseCommand {
       return;
     }
 
-    LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
     if (region == null) {
       String reason = " was not found during 6.1 put request";
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -172,8 +168,6 @@ public class Put61 extends BaseCommand {
       return;
     }
 
-    GeodeSecurityUtil.authorizeRegionWrite(regionName, key.toString());
-
     // try {
     // this.eventId = (EventID)eventPart.getObject();
     ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
@@ -189,6 +183,9 @@ public class Put61 extends BaseCommand {
       boolean isObject = valuePart.isObject();
       boolean isMetaRegion = region.isUsedForMetaRegion();
       msg.setMetaRegion(isMetaRegion);
+
+      this.securityService.authorizeRegionWrite(regionName, key.toString());
+
       AuthorizeRequest authzRequest = null;
       if (!isMetaRegion) {
         authzRequest = servConn.getAuthzRequest();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put65.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put65.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put65.java
index 960958f..0a4c200 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put65.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Put65.java
@@ -14,9 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/**
- *
- */
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.DataOutput;
@@ -53,7 +50,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.security.SecurityService;
 import com.gemstone.gemfire.internal.util.Breadcrumbs;
 import com.gemstone.gemfire.security.GemFireSecurityException;
 
@@ -68,9 +65,6 @@ public class Put65 extends BaseCommand {
     return singleton;
   }
 
-  protected Put65() {
-  }
-
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long p_start)
     throws IOException, InterruptedException {
@@ -189,7 +183,7 @@ public class Put65 extends BaseCommand {
       return;
     }
 
-    LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
     if (region == null) {
       String reason = " was not found during put request";
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -209,8 +203,6 @@ public class Put65 extends BaseCommand {
       return;
     }
 
-    GeodeSecurityUtil.authorizeRegionWrite(regionName, key.toString());
-
     ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
     long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
     long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
@@ -247,6 +239,9 @@ public class Put65 extends BaseCommand {
       boolean isObject = valuePart.isObject();
       boolean isMetaRegion = region.isUsedForMetaRegion();
       msg.setMetaRegion(isMetaRegion);
+
+      this.securityService.authorizeRegionWrite(regionName, key.toString());
+
       AuthorizeRequest authzRequest = null;
       if (!isMetaRegion) {
         authzRequest = servConn.getAuthzRequest();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll.java
index 8b24f3e..412b702 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll.java
@@ -48,12 +48,12 @@ 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;
 
 public class PutAll extends BaseCommand {
   
   private final static PutAll singleton = new PutAll();
-  
+
+
   public static Command getCommand() {
     return singleton;
   }
@@ -122,8 +122,6 @@ public class PutAll extends BaseCommand {
         return;
       }
 
-      GeodeSecurityUtil.authorizeRegionWrite(regionName);
-
       // part 1: eventID
       eventPart = msg.getPart(1);
       ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart
@@ -183,7 +181,8 @@ public class PutAll extends BaseCommand {
         servConn.setRequestSpecificTimeout(timeout);
       }
 
-      
+      this.securityService.authorizeRegionWrite(regionName);
+
       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/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll70.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll70.java
index 6e3aec9..73a82a6 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll70.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll70.java
@@ -51,12 +51,12 @@ 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;
 
 public class PutAll70 extends BaseCommand {
   
   private final static PutAll70 singleton = new PutAll70();
-  
+
+
   public static Command getCommand() {
     return singleton;
   }
@@ -129,8 +129,6 @@ public class PutAll70 extends BaseCommand {
         return;
       }
 
-      GeodeSecurityUtil.authorizeRegionWrite(regionName);
-
       // part 1: eventID
       eventPart = msg.getPart(1);
       ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart
@@ -225,7 +223,8 @@ public class PutAll70 extends BaseCommand {
         servConn.setRequestSpecificTimeout(timeout);
       }
 
-      
+      this.securityService.authorizeRegionWrite(regionName);
+
       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/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll80.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll80.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll80.java
index 06512ac..81ea585 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll80.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/PutAll80.java
@@ -52,13 +52,12 @@ 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 PutAll80 extends BaseCommand {
   
   private final static PutAll80 singleton = new PutAll80();
-  
+
   public static Command getCommand() {
     return singleton;
   }
@@ -143,8 +142,6 @@ public class PutAll80 extends BaseCommand {
         return;
       }
 
-      GeodeSecurityUtil.authorizeRegionWrite(regionName);
-
       final int BASE_PART_COUNT = getBasePartCount();
       
       // part 1: eventID
@@ -266,7 +263,8 @@ public class PutAll80 extends BaseCommand {
         servConn.setRequestSpecificTimeout(timeout);
       }
 
-      
+      this.securityService.authorizeRegionWrite(regionName);
+
       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/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterest.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterest.java
index 6381c7d..e071a27 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterest.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterest.java
@@ -26,7 +26,6 @@ import com.gemstone.gemfire.cache.InterestResultPolicy;
 import com.gemstone.gemfire.cache.operations.RegisterInterestOperationContext;
 import com.gemstone.gemfire.i18n.StringId;
 import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.internal.cache.tier.CachedRegionHelper;
 import com.gemstone.gemfire.internal.cache.tier.Command;
 import com.gemstone.gemfire.internal.cache.tier.InterestType;
 import com.gemstone.gemfire.internal.cache.tier.MessageType;
@@ -39,26 +38,25 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 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.security.IntegratedSecurityService;
+import com.gemstone.gemfire.internal.security.SecurityService;
 
 public class RegisterInterest extends BaseCommand {
 
   private final static RegisterInterest singleton = new RegisterInterest();
+  private SecurityService securityService = IntegratedSecurityService.getSecurityService();
+
 
   public static Command getCommand() {
     return singleton;
   }
 
-  private RegisterInterest() {
-  }
-
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start)
       throws IOException, InterruptedException {
     Part regionNamePart = null, keyPart = null;
     String regionName = null;
     Object key = null;
-    CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     servConn.setAsTrue(REQUIRES_RESPONSE);
     servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
 
@@ -142,16 +140,8 @@ public class RegisterInterest extends BaseCommand {
       return;
     }
 
-    if(interestType == InterestType.REGULAR_EXPRESSION) {
-      GeodeSecurityUtil.authorizeRegionRead(regionName);
-    }
-    else {
-      GeodeSecurityUtil.authorizeRegionRead(regionName, key.toString());
-    }
-
-
     // input key not null
-    LocalRegion region = (LocalRegion)crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion)servConn.getCache().getRegion(regionName);
     if (region == null) {
       logger.info(LocalizedMessage.create(LocalizedStrings.RegisterInterest_0_REGION_NAMED_1_WAS_NOT_FOUND_DURING_REGISTER_INTEREST_REQUEST, new Object[] {servConn.getName(), regionName}));
       // writeChunkedErrorResponse(msg,
@@ -160,6 +150,13 @@ public class RegisterInterest extends BaseCommand {
     }
     // Register interest
     try {
+      if (interestType == InterestType.REGULAR_EXPRESSION) {
+        this.securityService.authorizeRegionRead(regionName);
+      }
+      else {
+        this.securityService.authorizeRegionRead(regionName, key.toString());
+      }
+
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();
       if (authzRequest != null) {
         // TODO SW: This is a workaround for DynamicRegionFactory

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterest61.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterest61.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterest61.java
index a54775d..62c065f 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterest61.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterest61.java
@@ -42,7 +42,7 @@ import com.gemstone.gemfire.internal.cache.vmotion.VMotionObserverHolder;
 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;
+
 /**
  * @since GemFire 6.1
  */
@@ -59,7 +59,7 @@ public class RegisterInterest61 extends BaseCommand {
     return singleton;
   }
 
-  private RegisterInterest61() {
+  RegisterInterest61() {
   }
 
   @Override
@@ -175,15 +175,8 @@ public class RegisterInterest61 extends BaseCommand {
       return;
     }
 
-    if(interestType == InterestType.REGULAR_EXPRESSION) {
-      GeodeSecurityUtil.authorizeRegionRead(regionName);
-    }
-    else {
-      GeodeSecurityUtil.authorizeRegionRead(regionName, key.toString());
-    }
-
     // input key not null
-    LocalRegion region = (LocalRegion)crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion)servConn.getCache().getRegion(regionName);
     if (region == null) {
       logger.info(LocalizedMessage.create(LocalizedStrings.RegisterInterest_0_REGION_NAMED_1_WAS_NOT_FOUND_DURING_REGISTER_INTEREST_REQUEST, new Object[] {servConn.getName(), regionName}));
       // writeChunkedErrorResponse(msg,
@@ -192,6 +185,14 @@ public class RegisterInterest61 extends BaseCommand {
     }
     // Register interest
     try {
+
+      if(interestType == InterestType.REGULAR_EXPRESSION) {
+        this.securityService.authorizeRegionRead(regionName);
+      }
+      else {
+        this.securityService.authorizeRegionRead(regionName, key.toString());
+      }
+
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();
       if (authzRequest != null) {
         // TODO SW: This is a workaround for DynamicRegionFactory

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList.java
index bdc6f67..0153e4a 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList.java
@@ -32,7 +32,8 @@ import com.gemstone.gemfire.cache.DynamicRegionFactory;
 import com.gemstone.gemfire.cache.InterestResultPolicy;
 import com.gemstone.gemfire.cache.operations.RegisterInterestOperationContext;
 import com.gemstone.gemfire.i18n.StringId;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
+import com.gemstone.gemfire.internal.security.IntegratedSecurityService;
+import com.gemstone.gemfire.internal.security.SecurityService;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -49,7 +50,7 @@ public class RegisterInterestList extends BaseCommand {
     return singleton;
   }
 
-  private RegisterInterestList() {
+  RegisterInterestList() {
   }
 
   @Override
@@ -164,10 +165,8 @@ public class RegisterInterestList extends BaseCommand {
       return;
     }
 
-    GeodeSecurityUtil.authorizeRegionRead(regionName);
-
     // key not null
-      LocalRegion region = (LocalRegion)crHelper.getRegion(regionName);
+      LocalRegion region = (LocalRegion)servConn.getCache().getRegion(regionName);
       if (region == null) {
         logger.info(LocalizedMessage.create(LocalizedStrings.RegisterInterestList_0_REGION_NAMED_1_WAS_NOT_FOUND_DURING_REGISTER_INTEREST_LIST_REQUEST, new Object[]{servConn.getName(), regionName}));
         // writeChunkedErrorResponse(msg,
@@ -175,6 +174,7 @@ public class RegisterInterestList extends BaseCommand {
         // responded = true;
       } // else { // region not null
       try {
+        this.securityService.authorizeRegionRead(regionName);
         AuthorizeRequest authzRequest = servConn.getAuthzRequest();
         if (authzRequest != null) {
           // TODO SW: This is a workaround for DynamicRegionFactory

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList61.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList61.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList61.java
index 5931ebb..8130fc7 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList61.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList61.java
@@ -32,7 +32,6 @@ import com.gemstone.gemfire.cache.DynamicRegionFactory;
 import com.gemstone.gemfire.cache.InterestResultPolicy;
 import com.gemstone.gemfire.cache.operations.RegisterInterestOperationContext;
 import com.gemstone.gemfire.i18n.StringId;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -49,7 +48,7 @@ public class RegisterInterestList61 extends BaseCommand {
     return singleton;
   }
 
-  private RegisterInterestList61() {
+  RegisterInterestList61() {
   }
 
   @Override
@@ -175,9 +174,8 @@ public class RegisterInterestList61 extends BaseCommand {
       return;
     }
 
-    GeodeSecurityUtil.authorizeRegionRead(regionName);
 
-    LocalRegion region = (LocalRegion)crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion)servConn.getCache().getRegion(regionName);
     if (region == null) {
       logger.info(LocalizedMessage.create(LocalizedStrings.RegisterInterestList_0_REGION_NAMED_1_WAS_NOT_FOUND_DURING_REGISTER_INTEREST_LIST_REQUEST, new Object[]{servConn.getName(), regionName}));
       // writeChunkedErrorResponse(msg,
@@ -185,6 +183,7 @@ public class RegisterInterestList61 extends BaseCommand {
       // responded = true;
     } // else { // region not null
     try {
+      this.securityService.authorizeRegionRead(regionName);
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();
       if (authzRequest != null) {
         // TODO SW: This is a workaround for DynamicRegionFactory

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList66.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList66.java
index 264f1fb..03469bd 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList66.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/RegisterInterestList66.java
@@ -33,7 +33,6 @@ import com.gemstone.gemfire.cache.DynamicRegionFactory;
 import com.gemstone.gemfire.cache.InterestResultPolicy;
 import com.gemstone.gemfire.cache.operations.RegisterInterestOperationContext;
 import com.gemstone.gemfire.i18n.StringId;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 
 import java.io.IOException;
 import java.util.List;
@@ -56,7 +55,7 @@ public class RegisterInterestList66 extends BaseCommand {
     return singleton;
   }
 
-  private RegisterInterestList66() {
+  RegisterInterestList66() {
   }
 
   @Override
@@ -175,10 +174,9 @@ public class RegisterInterestList66 extends BaseCommand {
           s, servConn);
       servConn.setAsTrue(RESPONDED);
     }
-    GeodeSecurityUtil.authorizeRegionRead(regionName);
 
    // key not null
-      LocalRegion region = (LocalRegion)crHelper.getRegion(regionName);
+      LocalRegion region = (LocalRegion)servConn.getCache().getRegion(regionName);
       if (region == null) {
         logger.info(LocalizedMessage.create(LocalizedStrings.RegisterInterestList_0_REGION_NAMED_1_WAS_NOT_FOUND_DURING_REGISTER_INTEREST_LIST_REQUEST, new Object[]{servConn.getName(), regionName}));
         // writeChunkedErrorResponse(msg,
@@ -186,6 +184,7 @@ public class RegisterInterestList66 extends BaseCommand {
         // responded = true;
       } // else { // region not null
       try {
+        this.securityService.authorizeRegionRead(regionName);
         AuthorizeRequest authzRequest = servConn.getAuthzRequest();
         if (authzRequest != null) {
           // TODO SW: This is a workaround for DynamicRegionFactory

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/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 b5c5221..a09a3d3 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
@@ -49,7 +49,6 @@ 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 {
@@ -120,7 +119,7 @@ public class RemoveAll extends BaseCommand {
         servConn.setAsTrue(RESPONDED);
         return;
       }
-      LocalRegion region = (LocalRegion)crHelper.getRegion(regionName);
+      LocalRegion region = (LocalRegion)servConn.getCache().getRegion(regionName);
       if (region == null) {
         String reason = " was not found during removeAll request";
         writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -128,8 +127,6 @@ public class RemoveAll extends BaseCommand {
         return;
       }
 
-      GeodeSecurityUtil.authorizeRegionWrite(regionName);
-      
       // part 1: eventID
       eventPart = msg.getPart(1);
       ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart
@@ -212,6 +209,8 @@ public class RemoveAll extends BaseCommand {
         servConn.setRequestSpecificTimeout(timeout);
       }
 
+      this.securityService.authorizeRegionWrite(regionName);
+
       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/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Request.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Request.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Request.java
index 69d54a1..791329d 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Request.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Request.java
@@ -51,7 +51,7 @@ public class Request extends BaseCommand {
     return singleton;
   }
 
-  protected Request() {
+  Request() {
   }
 
   @Override
@@ -135,7 +135,7 @@ public class Request extends BaseCommand {
       servConn.setAsTrue(RESPONDED);
     }
     else {
-      Region region = crHelper.getRegion(regionName);
+      Region region = servConn.getCache().getRegion(regionName);
       if (region == null) {
         String reason = LocalizedStrings.Request__0_WAS_NOT_FOUND_DURING_GET_REQUEST.toLocalizedString(regionName);
         writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -146,6 +146,7 @@ public class Request extends BaseCommand {
         GetOperationContext getContext = null;
         
           try {
+            this.securityService.authorizeRegionRead(regionName, key.toString());
             AuthorizeRequest authzRequest = servConn.getAuthzRequest();
               if (authzRequest != null) {
               getContext = authzRequest

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Size.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Size.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Size.java
index 8b11d3d..eefdd42 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Size.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Size.java
@@ -34,7 +34,6 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.Part;
 import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 import com.gemstone.gemfire.security.GemFireSecurityException;
 
 
@@ -89,9 +88,9 @@ public class Size extends BaseCommand {
       return;
     }
 
-    GeodeSecurityUtil.authorizeRegionRead(regionName);
     // Size the entry
     try {
+      this.securityService.authorizeRegionRead(regionName);
           /*
            *
            * txtodo: doesn't seem like there is any notion of authzSize

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/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 7d07cd5..71f7665 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
@@ -33,7 +33,6 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.Part;
 import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 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;
 
 
@@ -45,7 +44,7 @@ public class UnregisterInterest extends BaseCommand {
     return singleton;
   }
 
-  private UnregisterInterest() {
+  UnregisterInterest() {
   }
 
   @Override
@@ -101,10 +100,16 @@ public class UnregisterInterest extends BaseCommand {
       return;
     }
 
+    try {
     if (interestType == InterestType.REGULAR_EXPRESSION) {
-      GeodeSecurityUtil.authorizeRegionRead(regionName);
+      this.securityService.authorizeRegionRead(regionName);
     } else {
-      GeodeSecurityUtil.authorizeRegionRead(regionName, key.toString());
+      this.securityService.authorizeRegionRead(regionName, key.toString());
+    }
+    } catch (NotAuthorizedException ex) {
+      writeException(msg, ex, false, servConn);
+      servConn.setAsTrue(RESPONDED);
+      return;
     }
 
     AuthorizeRequest authzRequest = servConn.getAuthzRequest();



Mime
View raw message