geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [29/50] [abbrv] incubator-geode git commit: GEODE-1712: introduce SecurityService interface for mocking
Date Wed, 10 Aug 2016 19:41:15 GMT
GEODE-1712: introduce SecurityService interface for mocking

* create Unit Tests for client commands that use security


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/f93b7485
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/f93b7485
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/f93b7485

Branch: refs/heads/feature/GEODE-420
Commit: f93b748537138b970b944f3aec05363de9bc7ffa
Parents: 88247e3
Author: gmeilen <gracemeilen@gmail.com>
Authored: Mon Jul 18 13:13:11 2016 -0700
Committer: Kirk Lund <klund@apache.org>
Committed: Thu Aug 4 09:44:29 2016 -0700

----------------------------------------------------------------------
 .../client/internal/ExecuteFunctionOp.java      |   4 +-
 .../gemfire/cache/execute/FunctionService.java  |   4 +-
 .../internal/FunctionServiceManager.java        |   2 +-
 .../membership/gms/auth/GMSAuthenticator.java   |  14 +-
 .../gemfire/internal/cache/TXManagerImpl.java   |   2 +-
 .../DistributedRegionFunctionResultSender.java  |  28 +-
 .../cache/execute/FunctionServiceStats.java     |   9 +
 .../internal/cache/execute/FunctionStats.java   |  50 ++-
 .../PartitionedRegionFunctionResultSender.java  |  14 +-
 .../cache/execute/ServerFunctionExecutor.java   |   8 +-
 .../ServerToClientFunctionResultSender.java     |   8 +-
 .../ServerToClientFunctionResultSender65.java   |   8 +-
 .../cache/tier/sockets/AcceptorImpl.java        |  12 +-
 .../cache/tier/sockets/BaseCommand.java         |   9 +-
 .../cache/tier/sockets/BaseCommandQuery.java    |  23 +-
 .../cache/tier/sockets/CacheClientProxy.java    |   9 +-
 .../cache/tier/sockets/CacheServerStats.java    | 170 +++++-----
 .../internal/cache/tier/sockets/HandShake.java  |  14 +-
 .../internal/cache/tier/sockets/Part.java       |  18 +-
 .../cache/tier/sockets/ServerConnection.java    |   6 +-
 .../cache/tier/sockets/command/ClearRegion.java |   9 +-
 .../cache/tier/sockets/command/ContainsKey.java |  26 +-
 .../tier/sockets/command/ContainsKey66.java     |  18 +-
 .../tier/sockets/command/CreateRegion.java      |  17 +-
 .../cache/tier/sockets/command/Destroy.java     |  18 +-
 .../cache/tier/sockets/command/Destroy65.java   |  15 +-
 .../tier/sockets/command/DestroyRegion.java     |  19 +-
 .../tier/sockets/command/ExecuteFunction.java   |  21 +-
 .../tier/sockets/command/ExecuteFunction65.java |  16 +-
 .../tier/sockets/command/ExecuteFunction66.java |  13 +-
 .../sockets/command/ExecuteRegionFunction.java  |   7 +-
 .../command/ExecuteRegionFunction65.java        |   6 +-
 .../command/ExecuteRegionFunction66.java        |   6 +-
 .../command/ExecuteRegionFunctionSingleHop.java |   6 +-
 .../cache/tier/sockets/command/Get70.java       |  17 +-
 .../cache/tier/sockets/command/GetAll.java      |  13 +-
 .../cache/tier/sockets/command/GetAll651.java   |  13 +-
 .../cache/tier/sockets/command/GetAll70.java    |  17 +-
 .../sockets/command/GetAllWithCallback.java     |  10 +-
 .../GetClientPartitionAttributesCommand.java    |  13 +-
 .../GetClientPartitionAttributesCommand66.java  |   9 +-
 .../cache/tier/sockets/command/GetEntry70.java  |   1 -
 .../sockets/command/GetFunctionAttribute.java   |   6 +-
 .../cache/tier/sockets/command/Invalidate.java  |  17 +-
 .../tier/sockets/command/Invalidate70.java      |   3 -
 .../cache/tier/sockets/command/KeySet.java      |  16 +-
 .../cache/tier/sockets/command/Put.java         |  13 +-
 .../cache/tier/sockets/command/Put61.java       |  11 +-
 .../cache/tier/sockets/command/Put65.java       |  15 +-
 .../cache/tier/sockets/command/PutAll.java      |   9 +-
 .../cache/tier/sockets/command/PutAll70.java    |   9 +-
 .../cache/tier/sockets/command/PutAll80.java    |   8 +-
 .../tier/sockets/command/RegisterInterest.java  |  27 +-
 .../sockets/command/RegisterInterest61.java     |  21 +-
 .../sockets/command/RegisterInterestList.java   |  10 +-
 .../sockets/command/RegisterInterestList61.java |   7 +-
 .../sockets/command/RegisterInterestList66.java |   7 +-
 .../cache/tier/sockets/command/RemoveAll.java   |   7 +-
 .../cache/tier/sockets/command/Request.java     |   5 +-
 .../cache/tier/sockets/command/Size.java        |   3 +-
 .../sockets/command/UnregisterInterest.java     |  13 +-
 .../sockets/command/UnregisterInterestList.java |  10 +-
 .../internal/security/GeodeSecurityUtil.java    |   2 +-
 .../security/IntegratedSecurityService.java     | 158 +++++++++
 .../internal/security/SecurityService.java      |  57 ++++
 .../security/shiro/CustomAuthRealm.java         |   6 +-
 .../security/shiro/JMXShiroAuthenticator.java   |   9 +-
 .../internal/SystemManagementService.java       |   9 +-
 .../CreateAlterDestroyRegionCommands.java       |   7 +-
 .../internal/cli/commands/DataCommands.java     |  20 +-
 .../internal/cli/commands/IndexCommands.java    |  13 +-
 .../cli/functions/DataCommandFunction.java      |  13 +-
 .../internal/cli/remote/CommandProcessor.java   |   7 +-
 .../internal/security/AccessControlMBean.java   |   7 +-
 .../internal/security/MBeanServerWrapper.java   |  10 +-
 .../controllers/AbstractCommandsController.java |   7 +-
 .../support/LoginHandlerInterceptor.java        |  10 +-
 .../auth/AbstractGMSAuthenticatorTestCase.java  | 303 +++++++++++++++++
 .../gms/auth/GMSAuthenticatorJUnitTest.java     | 338 -------------------
 .../GMSAuthenticatorWithAuthenticatorTest.java  | 186 ++++++++++
 ...GMSAuthenticatorWithSecurityManagerTest.java | 152 +++++++++
 .../tier/sockets/command/ContainsKey66Test.java | 156 +++++++++
 .../tier/sockets/command/ContainsKeyTest.java   | 148 ++++++++
 .../tier/sockets/command/CreateRegionTest.java  | 163 +++++++++
 .../tier/sockets/command/Destroy65Test.java     | 173 ++++++++++
 .../tier/sockets/command/DestroyRegionTest.java | 165 +++++++++
 .../cache/tier/sockets/command/DestroyTest.java | 177 ++++++++++
 .../sockets/command/ExecuteFunction65Test.java  | 207 ++++++++++++
 .../sockets/command/ExecuteFunction66Test.java  | 204 +++++++++++
 .../sockets/command/ExecuteFunctionTest.java    | 209 ++++++++++++
 .../cache/tier/sockets/command/Get70Test.java   | 169 ++++++++++
 .../tier/sockets/command/GetAll651Test.java     | 201 +++++++++++
 .../tier/sockets/command/GetAll70Test.java      | 214 ++++++++++++
 .../cache/tier/sockets/command/GetAllTest.java  | 201 +++++++++++
 .../sockets/command/GetAllWithCallbackTest.java | 213 ++++++++++++
 ...tClientPartitionAttributesCommand66Test.java |  86 +++++
 ...GetClientPartitionAttributesCommandTest.java |  86 +++++
 .../tier/sockets/command/InvalidateTest.java    | 176 ++++++++++
 .../cache/tier/sockets/command/KeySetTest.java  | 160 +++++++++
 .../cache/tier/sockets/command/Put61Test.java   | 202 +++++++++++
 .../cache/tier/sockets/command/Put65Test.java   | 223 ++++++++++++
 .../cache/tier/sockets/command/PutTest.java     | 197 +++++++++++
 .../sockets/command/RegisterInterest61Test.java | 184 ++++++++++
 .../command/RegisterInterestList61Test.java     | 186 ++++++++++
 .../command/RegisterInterestList66Test.java     | 192 +++++++++++
 .../command/RegisterInterestListTest.java       | 186 ++++++++++
 .../sockets/command/RegisterInterestTest.java   | 185 ++++++++++
 .../tier/sockets/command/RemoveAllTest.java     | 199 +++++++++++
 .../cache/tier/sockets/command/RequestTest.java | 164 +++++++++
 .../sockets/command/UnregisterInterestTest.java | 200 +++++++++++
 .../GeodeSecurityUtilCustomRealmJUnitTest.java  |   3 +-
 .../GeodeSecurityUtilWithIniFileJUnitTest.java  |  80 ++---
 ...edSecurityCacheLifecycleIntegrationTest.java |   1 +
 .../cache/tier/sockets/command/CloseCQ.java     |   3 +-
 .../cache/tier/sockets/command/GetCQStats.java  |   3 +-
 .../tier/sockets/command/GetDurableCQs.java     |   3 +-
 .../cache/tier/sockets/command/MonitorCQ.java   |   3 +-
 .../cache/tier/sockets/command/StopCQ.java      |   3 +-
 .../internal/cli/LuceneIndexCommands.java       |  12 +-
 119 files changed, 6646 insertions(+), 924 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/ExecuteFunctionOp.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/ExecuteFunctionOp.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/ExecuteFunctionOp.java
index 624e884..278f1f7 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/ExecuteFunctionOp.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/ExecuteFunctionOp.java
@@ -551,7 +551,7 @@ public class ExecuteFunctionOp {
                   DistributedMember memberID = (DistributedMember)((ArrayList)resultResponse)
                       .get(1);
                   this.resultCollector.addResult(memberID, cause);
-                  FunctionStats.getFunctionStats(this.functionId, null)
+                  FunctionStats.getFunctionStats(this.functionId)
                       .incResultsReceived();
                   continue;
                 }
@@ -571,7 +571,7 @@ public class ExecuteFunctionOp {
                 synchronized (resultCollector) {
                   resultCollector.addResult(memberID, result);                    
                 }
-                FunctionStats.getFunctionStats(this.functionId, null)
+                FunctionStats.getFunctionStats(this.functionId)
                     .incResultsReceived();
               }
             }while(!executeFunctionResponseMsg.isLastChunk());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/FunctionService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/FunctionService.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/FunctionService.java
index 4ae2e72..5536978 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/FunctionService.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/FunctionService.java
@@ -41,10 +41,10 @@ import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
  * 
  * @since GemFire 6.0
  */
-public final class FunctionService {
+public class FunctionService {
   private static final FunctionServiceManager functionSvcMgr= new FunctionServiceManager();
   
-  private FunctionService() {}
+  FunctionService() {}
 
   /**
    * Returns an {@link Execution} object that can be used to execute a data

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/internal/FunctionServiceManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/internal/FunctionServiceManager.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/internal/FunctionServiceManager.java
index 91108c1..32756ea 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/internal/FunctionServiceManager.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/internal/FunctionServiceManager.java
@@ -53,7 +53,7 @@ import java.util.concurrent.ConcurrentHashMap;
  * 
  * @since GemFire 7.0
  */
-public final class FunctionServiceManager {
+public class FunctionServiceManager {
   private final static ConcurrentHashMap<String, Function> idToFunctionMap = new ConcurrentHashMap<String, Function>();
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticator.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticator.java
index cf99ea2..516ca74 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticator.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticator.java
@@ -31,17 +31,18 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Authe
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.InternalLogWriter;
 import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
+import com.gemstone.gemfire.internal.security.IntegratedSecurityService;
+import com.gemstone.gemfire.internal.security.SecurityService;
 import com.gemstone.gemfire.security.AuthInitialize;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.AuthenticationRequiredException;
 import com.gemstone.gemfire.security.GemFireSecurityException;
 
-// static messages
-
 public class GMSAuthenticator implements Authenticator {
 
   private Services services;
   private Properties securityProps;
+  private SecurityService securityService = IntegratedSecurityService.getSecurityService();
 
   @Override
   public void init(Services s) {
@@ -107,7 +108,7 @@ public class GMSAuthenticator implements Authenticator {
    * Method is package protected to be used in testing.
    */
   String authenticate(DistributedMember member, Properties credentials, Properties secProps, DistributedMember localMember) throws AuthenticationFailedException {
-    if(!GeodeSecurityUtil.isPeerSecurityRequired()){
+    if (!this.securityService.isPeerSecurityRequired()) {
       return null;
     }
 
@@ -120,10 +121,10 @@ public class GMSAuthenticator implements Authenticator {
 
     String failMsg = null;
     try {
-      if(GeodeSecurityUtil.isIntegratedSecurity()){
+      if(this.securityService.isIntegratedSecurity()){
         String username = credentials.getProperty("security-username");
         String password = credentials.getProperty("security-password");
-        GeodeSecurityUtil.login(username, password);
+        this.securityService.login(username, password);
       }
       else {
         invokeAuthenticator(secProps, member, credentials);
@@ -145,7 +146,7 @@ public class GMSAuthenticator implements Authenticator {
       String authMethod = securityProps.getProperty(SECURITY_PEER_AUTHENTICATOR);
     com.gemstone.gemfire.security.Authenticator auth = null;
     try {
-      auth = GeodeSecurityUtil.getObjectOfTypeFromFactoryMethod(authMethod, com.gemstone.gemfire.security.Authenticator .class);
+      auth = GeodeSecurityUtil.getObjectOfTypeFromFactoryMethod(authMethod, com.gemstone.gemfire.security.Authenticator.class);
 
       LogWriter logWriter = this.services.getLogWriter();
       LogWriter securityLogWriter = this.services.getSecurityLogWriter();
@@ -193,6 +194,7 @@ public class GMSAuthenticator implements Authenticator {
     try {
       if (authMethod != null && authMethod.length() > 0) {
         AuthInitialize auth = GeodeSecurityUtil.getObjectOfType(authMethod, AuthInitialize.class);
+        assert auth != null;
         try {
           LogWriter logWriter = services.getLogWriter();
           LogWriter securityLogWriter = services.getSecurityLogWriter();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java
index dc668eb..ab082e0 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java
@@ -548,7 +548,7 @@ public class TXManagerImpl implements CacheTransactionManager,
   /** 
    * Returns the TXStateProxyInterface of the current thread; null if no transaction.
    */
-  public final TXStateProxy getTXState() {
+  public TXStateProxy getTXState() {
     TXStateProxy tsp = txContext.get();
     if (tsp != null && !tsp.isInProgress()) {
       this.txContext.set(null);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionResultSender.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionResultSender.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionResultSender.java
index fc85427..e2ccfa1 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionResultSender.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionResultSender.java
@@ -139,8 +139,11 @@ public final class DistributedRegionFunctionResultSender implements
       if (isLocal) {
         this.rc.addResult(memberID, oneResult);
         this.rc.endResults();
-        FunctionStats.getFunctionStats(functionObject.getId(),
-            this.dm == null ? null : this.dm.getSystem()).incResultsReceived();
+        if (this.dm == null) {
+          FunctionStats.getFunctionStats(functionObject.getId()).incResultsReceived();
+        } else {
+          FunctionStats.getFunctionStats(functionObject.getId(), this.dm.getSystem()).incResultsReceived();
+        }
       }
       else {
         try {
@@ -154,8 +157,11 @@ public final class DistributedRegionFunctionResultSender implements
         }
       }
       // incrementing result sent stats.
-      FunctionStats.getFunctionStats(functionObject.getId(),
-          this.dm == null ? null : this.dm.getSystem()).incResultsReturned();
+      if (this.dm == null) {
+        FunctionStats.getFunctionStats(functionObject.getId()).incResultsReceived();
+      } else {
+        FunctionStats.getFunctionStats(functionObject.getId(), this.dm.getSystem()).incResultsReceived();
+      }
     }
 
   }
@@ -205,8 +211,11 @@ public final class DistributedRegionFunctionResultSender implements
     else {
       if (isLocal) {
         this.rc.addResult(memberID, oneResult);
-        FunctionStats.getFunctionStats(functionObject.getId(),
-            this.dm == null ? null : this.dm.getSystem()).incResultsReceived();
+        if (this.dm == null) {
+          FunctionStats.getFunctionStats(functionObject.getId()).incResultsReceived();
+        } else {
+          FunctionStats.getFunctionStats(functionObject.getId(), this.dm.getSystem()).incResultsReceived();
+        }
       }
       else {
         try {
@@ -220,8 +229,11 @@ public final class DistributedRegionFunctionResultSender implements
         }
       }
       // incrementing result sent stats.
-      FunctionStats.getFunctionStats(functionObject.getId(),
-          this.dm == null ? null : this.dm.getSystem()).incResultsReturned();
+      if (this.dm == null) {
+        FunctionStats.getFunctionStats(functionObject.getId()).incResultsReturned();
+      } else {
+        FunctionStats.getFunctionStats(functionObject.getId(), this.dm.getSystem()).incResultsReturned();
+      }
     }
   }
   

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStats.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStats.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStats.java
index 905211a..e62d800 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStats.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStats.java
@@ -22,6 +22,7 @@ import com.gemstone.gemfire.StatisticsFactory;
 import com.gemstone.gemfire.StatisticsType;
 import com.gemstone.gemfire.StatisticsTypeFactory;
 import com.gemstone.gemfire.distributed.internal.DistributionStats;
+import com.gemstone.gemfire.internal.DummyStatisticsImpl;
 import com.gemstone.gemfire.internal.StatisticsTypeFactoryImpl;
 
 public class FunctionServiceStats {
@@ -203,6 +204,14 @@ public class FunctionServiceStats {
     this._stats = factory.createAtomicStatistics(_type, name);
   }
 
+  private FunctionServiceStats() {
+    this._stats = new DummyStatisticsImpl(this._type, null, 0);
+  }
+
+  static FunctionServiceStats createDummy() {
+    return new FunctionServiceStats();
+  }
+
   // /////////////////// Instance Methods /////////////////////
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/FunctionStats.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/FunctionStats.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/FunctionStats.java
index 756cfdd..35b82d3 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/FunctionStats.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/FunctionStats.java
@@ -20,6 +20,7 @@ import com.gemstone.gemfire.*;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.DistributionStats;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.DummyStatisticsImpl;
 import com.gemstone.gemfire.internal.StatisticsTypeFactoryImpl;
 
 public class FunctionStats {
@@ -233,14 +234,17 @@ public class FunctionStats {
   private final Statistics _stats;
   
   /** This is an instance of the FunctionStats when the statsDisabled = true;*/
-  private static FunctionStats disabledStats ;
+  private final static FunctionStats dummy = createDummy();
   
   // ///////////////////// Constructors ///////////////////////
 
   private FunctionStats() {
-    InternalDistributedSystem iDS = InternalDistributedSystem.getAnyInstance();
-    this._stats = iDS.createAtomicStatistics(this._type);
-    aggregateStats = iDS.getFunctionServiceStats();
+    this._stats = new DummyStatisticsImpl(this._type, null, 0);
+    this.aggregateStats = FunctionServiceStats.createDummy();
+  }
+
+  static FunctionStats createDummy() {
+    return new FunctionStats();
   }
   
   /**
@@ -256,15 +260,6 @@ public class FunctionStats {
     this._stats = factory.createAtomicStatistics(_type,name);
     aggregateStats = ((InternalDistributedSystem)factory).getFunctionServiceStats();
   }
-  
-
-//  // /////////////////// Instance Methods /////////////////////
-//
-//  public FunctionStats(Statistics statistics) {
-//    this._stats = statistics;
-//  }
-
-
 
   /**
    * Closes the <code>FunctionServiceStats</code>.
@@ -512,22 +507,25 @@ public class FunctionStats {
    *          represents the Distributed System       
    * @return object of the FunctionStats
    */
-  
-  public static FunctionStats getFunctionStats(String functionID,
-      InternalDistributedSystem ds) {
-    boolean statsDisabled = Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "statsDisabled");
-    if (statsDisabled) {
-      if(disabledStats == null){
-        disabledStats = new FunctionStats();
-      }
-      return disabledStats;
+  public static FunctionStats getFunctionStats(String functionID, InternalDistributedSystem ds) {
+    if (isDisabled()) {
+      return dummy;
+    } else {
+      return ds.getFunctionStats(functionID);
     }
-   else {
-      if (ds == null) {
-        ds = InternalDistributedSystem.getAnyInstance();
-      }
+  }
+
+  public static FunctionStats getFunctionStats(String functionID) {
+    if (isDisabled()) {
+      return dummy;
+    } else {
+      InternalDistributedSystem ds = InternalDistributedSystem.getAnyInstance();
       return ds.getFunctionStats(functionID);
     }
   }
+
+  private static boolean isDisabled() {
+    return Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "statsDisabled");
+  }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/PartitionedRegionFunctionResultSender.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/PartitionedRegionFunctionResultSender.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/PartitionedRegionFunctionResultSender.java
index f4ee2d0..d16e9b5 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/PartitionedRegionFunctionResultSender.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/PartitionedRegionFunctionResultSender.java
@@ -251,11 +251,17 @@ public final class PartitionedRegionFunctionResultSender implements
       else {
         reply.addResult(memberID, oneResult);
       }
-      FunctionStats.getFunctionStats(function.getId(),
-          this.dm == null ? null : this.dm.getSystem()).incResultsReceived();
+      if (this.dm == null) {
+        FunctionStats.getFunctionStats(function.getId()).incResultsReceived();
+      } else {
+        FunctionStats.getFunctionStats(function.getId(), this.dm.getSystem()).incResultsReceived();
+      }
+    }
+    if (this.dm == null) {
+      FunctionStats.getFunctionStats(function.getId()).incResultsReturned();
+    } else {
+      FunctionStats.getFunctionStats(function.getId(), this.dm.getSystem()).incResultsReturned();
     }
-    FunctionStats.getFunctionStats(function.getId(),
-        this.dm == null ? null : this.dm.getSystem()).incResultsReturned();
   }
       
   public void sendResult(Object oneResult) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerFunctionExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerFunctionExecutor.java
index d821b32..0cca113 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerFunctionExecutor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerFunctionExecutor.java
@@ -147,7 +147,7 @@ public class ServerFunctionExecutor extends AbstractExecution {
 
   private ResultCollector executeOnServer(Function function,
       ResultCollector rc, byte hasResult) {
-    FunctionStats stats = FunctionStats.getFunctionStats(function.getId(), null);
+    FunctionStats stats = FunctionStats.getFunctionStats(function.getId());
     try {
       validateExecution(function, null);
       long start = stats.startTime();
@@ -174,7 +174,7 @@ public class ServerFunctionExecutor extends AbstractExecution {
   
   private ResultCollector executeOnServer(String functionId,
       ResultCollector rc, byte hasResult, boolean isHA, boolean optimizeForWrite) {
-    FunctionStats stats = FunctionStats.getFunctionStats(functionId, null);
+    FunctionStats stats = FunctionStats.getFunctionStats(functionId);
     try {
       validateExecution(null, null);
       long start = stats.startTime();
@@ -199,7 +199,7 @@ public class ServerFunctionExecutor extends AbstractExecution {
   }
 
   private void executeOnServerNoAck(Function function, byte hasResult) {
-    FunctionStats stats = FunctionStats.getFunctionStats(function.getId(), null);
+    FunctionStats stats = FunctionStats.getFunctionStats(function.getId());
     try {
       validateExecution(function, null);
       long start = stats.startTime();
@@ -223,7 +223,7 @@ public class ServerFunctionExecutor extends AbstractExecution {
 
   private void executeOnServerNoAck(String functionId, byte hasResult,
       boolean isHA, boolean optimizeForWrite) {
-    FunctionStats stats = FunctionStats.getFunctionStats(functionId, null);
+    FunctionStats stats = FunctionStats.getFunctionStats(functionId);
     try {
       validateExecution(null, null);
       long start = stats.startTime();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender.java
index 14b81a1..9a3b5d8 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender.java
@@ -117,7 +117,7 @@ public class ServerToClientFunctionResultSender implements ResultSender {
       this.msg.sendChunk(this.sc);
       this.sc.setAsTrue(Command.RESPONDED);
       
-      FunctionStats.getFunctionStats(fn.getId(), null).incResultsReturned();
+      FunctionStats.getFunctionStats(fn.getId()).incResultsReturned();
     }
     catch (IOException ex) {
       if (isOkayToSendResult()) {
@@ -157,7 +157,7 @@ public class ServerToClientFunctionResultSender implements ResultSender {
       this.msg.setLastChunk(true);
       this.msg.sendChunk(this.sc);
       this.sc.setAsTrue(Command.RESPONDED);
-      FunctionStats.getFunctionStats(fn.getId(), null).incResultsReturned();
+      FunctionStats.getFunctionStats(fn.getId()).incResultsReturned();
     }
     catch (IOException ex) {
       if (isOkayToSendResult()) {
@@ -192,7 +192,7 @@ public class ServerToClientFunctionResultSender implements ResultSender {
       this.msg.setNumberOfParts(1);
       this.msg.addObjPart(oneResult);
       this.msg.sendChunk(this.sc);
-      FunctionStats.getFunctionStats(fn.getId(), null).incResultsReturned();
+      FunctionStats.getFunctionStats(fn.getId()).incResultsReturned();
     }
     catch (IOException ex) {
       if (isOkayToSendResult()) {
@@ -228,7 +228,7 @@ public class ServerToClientFunctionResultSender implements ResultSender {
       this.msg.setNumberOfParts(1);
       this.msg.addObjPart(oneResult);
       this.msg.sendChunk(this.sc);
-      FunctionStats.getFunctionStats(fn.getId(), null).incResultsReturned();
+      FunctionStats.getFunctionStats(fn.getId()).incResultsReturned();
     }
     catch (IOException ex) {
       if (isOkayToSendResult()) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender65.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender65.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender65.java
index 4f248ca..4cc80a3 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender65.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender65.java
@@ -98,7 +98,7 @@ public class ServerToClientFunctionResultSender65 extends
       }
       this.msg.sendChunk(this.sc);
       this.sc.setAsTrue(Command.RESPONDED);
-      FunctionStats.getFunctionStats(fn.getId(), null).incResultsReturned();
+      FunctionStats.getFunctionStats(fn.getId()).incResultsReturned();
     }
     catch (IOException ex) {
       if (isOkayToSendResult()) {
@@ -155,7 +155,7 @@ public class ServerToClientFunctionResultSender65 extends
       }
       this.msg.sendChunk(this.sc);
       this.sc.setAsTrue(Command.RESPONDED);
-      FunctionStats.getFunctionStats(fn.getId(), null).incResultsReturned();
+      FunctionStats.getFunctionStats(fn.getId()).incResultsReturned();
     }
     catch (IOException ex) {
       if (isOkayToSendResult()) {
@@ -196,7 +196,7 @@ public class ServerToClientFunctionResultSender65 extends
       this.msg.setNumberOfParts(1);
       this.msg.addObjPart(result);
       this.msg.sendChunk(this.sc);
-      FunctionStats.getFunctionStats(fn.getId(), null).incResultsReturned();
+      FunctionStats.getFunctionStats(fn.getId()).incResultsReturned();
     }
     catch (IOException ex) {
       if (isOkayToSendResult()) {
@@ -237,7 +237,7 @@ public class ServerToClientFunctionResultSender65 extends
       this.msg.setNumberOfParts(1);
       this.msg.addObjPart(result);
       this.msg.sendChunk(this.sc);
-      FunctionStats.getFunctionStats(fn.getId(), null).incResultsReturned();
+      FunctionStats.getFunctionStats(fn.getId()).incResultsReturned();
     }
     catch (IOException ex) {
       if (isOkayToSendResult()) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/AcceptorImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/AcceptorImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/AcceptorImpl.java
index d016fd3..d095d6f 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/AcceptorImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/AcceptorImpl.java
@@ -90,7 +90,8 @@ import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
+import com.gemstone.gemfire.internal.security.IntegratedSecurityService;
+import com.gemstone.gemfire.internal.security.SecurityService;
 import com.gemstone.gemfire.internal.tcp.ConnectionTable;
 import com.gemstone.gemfire.internal.util.ArrayUtils;
 
@@ -197,7 +198,7 @@ public class AcceptorImpl extends Acceptor implements Runnable
   private final int socketBufferSize;
 
   /** Notifies clients of updates */
-  private final CacheClientNotifier clientNotifier;
+  private CacheClientNotifier clientNotifier;
 
   /**
    * The default value of the {@link ServerSocket}
@@ -275,6 +276,9 @@ public class AcceptorImpl extends Acceptor implements Runnable
   private boolean isGatewayReceiver;
   private List<GatewayTransportFilter> gatewayTransportFilters;
   private final SocketCreator socketCreator; 
+  
+  private SecurityService securityService = IntegratedSecurityService.getSecurityService();
+  
   /**
    * Initializes this acceptor thread to listen for connections on the given
    * port.
@@ -638,9 +642,9 @@ public class AcceptorImpl extends Acceptor implements Runnable
       this.hsPool = tmp_hsPool;
     }
 
-    isAuthenticationRequired = GeodeSecurityUtil.isClientSecurityRequired();
+    isAuthenticationRequired = this.securityService.isClientSecurityRequired();
 
-    isIntegratedSecurity = GeodeSecurityUtil.isIntegratedSecurity();
+    isIntegratedSecurity = this.securityService.isIntegratedSecurity();
 
     String postAuthzFactoryName = this.cache.getDistributedSystem()
         .getProperties().getProperty(SECURITY_CLIENT_ACCESSOR_PP);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommand.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommand.java
index 2d71452..c7003da 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommand.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommand.java
@@ -41,10 +41,10 @@ import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
 import com.gemstone.gemfire.internal.offheap.OffHeapHelper;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
+import com.gemstone.gemfire.internal.security.IntegratedSecurityService;
+import com.gemstone.gemfire.internal.security.SecurityService;
 import com.gemstone.gemfire.internal.sequencelog.EntryLogger;
 import com.gemstone.gemfire.security.GemFireSecurityException;
-import com.gemstone.gemfire.security.NotAuthorizedException;
 
 import org.apache.logging.log4j.Logger;
 
@@ -53,9 +53,6 @@ import java.util.*;
 import java.util.concurrent.Semaphore;
 import java.util.regex.Pattern;
 
-/**
- *
- */
 public abstract class BaseCommand implements Command {
   protected static final Logger logger = LogService.getLogger();
 
@@ -121,6 +118,8 @@ public abstract class BaseCommand implements Command {
 
   }
 
+  protected SecurityService securityService = IntegratedSecurityService.getSecurityService();
+
   final public void execute(Message msg, ServerConnection servConn) {
     // Read the request and update the statistics
     long 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/BaseCommandQuery.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommandQuery.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommandQuery.java
index f788d02..330c461 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommandQuery.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommandQuery.java
@@ -44,7 +44,6 @@ import com.gemstone.gemfire.internal.cache.tier.MessageType;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
 import com.gemstone.gemfire.internal.security.AuthorizeRequestPP;
-import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 
 public abstract class BaseCommandQuery extends BaseCommand {
 
@@ -63,7 +62,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
    *         false in case of failure.
    * @throws IOException
    */
-  protected static boolean processQuery(Message msg, Query query,
+  protected boolean processQuery(Message msg, Query query,
       String queryString, Set regionNames, long start, ServerCQ cqQuery,
       QueryOperationContext queryContext, ServerConnection servConn, 
       boolean sendResults)
@@ -87,7 +86,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
    *         false in case of failure.
    * @throws IOException
    */
-  protected static boolean processQueryUsingParams(Message msg, Query query,
+  protected boolean processQueryUsingParams(Message msg, Query query,
       String queryString, Set regionNames, long start, ServerCQ cqQuery,
       QueryOperationContext queryContext, ServerConnection servConn, 
       boolean sendResults, Object[] params)
@@ -111,7 +110,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
     try {
       // integrated security
       for(Object regionName:regionNames){
-        GeodeSecurityUtil.authorizeRegionRead(regionName.toString());
+        this.securityService.authorizeRegionRead(regionName.toString());
       }
 
       // Execute query
@@ -309,7 +308,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
     return true;
   }
 
-  private static boolean sendCqResultsWithKey(ServerConnection servConn) {
+  private boolean sendCqResultsWithKey(ServerConnection servConn) {
     Version clientVersion = servConn.getClientVersion();
     if (clientVersion.compareTo(Version.GFE_65) >= 0) {
       return true;
@@ -317,7 +316,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
     return false;
   }
 
-  protected static void sendCqResponse(int msgType, String msgStr, int txId,
+  protected void sendCqResponse(int msgType, String msgStr, int txId,
       Throwable e, ServerConnection servConn) throws IOException {
     ChunkedMessage cqMsg = servConn.getChunkedResponseMessage();
     if (logger.isDebugEnabled()) {
@@ -366,8 +365,8 @@ public abstract class BaseCommandQuery extends BaseCommand {
     }
   }
 
-  private static void sendResultsAsObjectArray(SelectResults selectResults,
-      int numberOfChunks, ServerConnection servConn,
+  private void sendResultsAsObjectArray(SelectResults selectResults,
+      int numberOfChunks, ServerConnection servConn, 
       boolean isStructs, CollectionType collectionType, String queryString, ServerCQ cqQuery, boolean sendCqResultsWithKey, boolean sendResults)
       throws IOException {
     int resultIndex = 0;
@@ -457,7 +456,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
     }
   }
 
-  private static void sendResultsAsObjectPartList(int numberOfChunks,
+  private void sendResultsAsObjectPartList(int numberOfChunks,
       ServerConnection servConn, List objs, boolean isStructs,
       CollectionType collectionType, String queryString, ServerCQ cqQuery, boolean sendCqResultsWithKey, boolean sendResults)
       throws IOException {
@@ -522,7 +521,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
    }
   }
 
-  private static void addToObjectPartList(ObjectPartList serializedObjs,
+  private void addToObjectPartList(ObjectPartList serializedObjs,
       Object res, CollectionType collectionType, boolean lastChunk,
       ServerConnection servConn, boolean isStructs) throws IOException {
     if (isStructs && (res instanceof Struct)) {
@@ -552,7 +551,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
     }
   }
 
-  private static void addObjectToPartList(ObjectPartList objPartList, Object key, Object value) {
+  private void addObjectToPartList(ObjectPartList objPartList, Object key, Object value) {
     Object object = value;
     boolean isObject = true;
     if (value instanceof CachedDeserializable) {
@@ -562,7 +561,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
       isObject = false;
     }
 
-    object = GeodeSecurityUtil.postProcess(null, key, object, isObject);
+    object = this.securityService.postProcess(null, key, object, isObject);
     if(key!=null){
       objPartList.addPart(null, key, ObjectPartList.OBJECT, null);
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java
index e798e2e..e94ef35 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java
@@ -107,6 +107,9 @@ import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
 import com.gemstone.gemfire.internal.logging.log4j.LogMarker;
 import com.gemstone.gemfire.internal.security.AuthorizeRequestPP;
 import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
+import com.gemstone.gemfire.internal.security.IntegratedSecurityService;
+import com.gemstone.gemfire.internal.security.SecurityService;
+import com.gemstone.gemfire.internal.util.BlobHelper;
 import com.gemstone.gemfire.security.AccessControl;
 
 /**
@@ -336,6 +339,8 @@ public class CacheClientProxy implements ClientSession {
   /** number of cq drains that are currently in progress **/
   private int numDrainsInProgress = 0;
   private final Object drainsInProgressLock = new Object();
+
+  private SecurityService securityService = IntegratedSecurityService.getSecurityService();
   
   /**
    * Constructor.
@@ -1662,7 +1667,7 @@ public class CacheClientProxy implements ClientSession {
    */
   protected void deliverMessage(Conflatable conflatable)
   {
-    ThreadState state = GeodeSecurityUtil.bindSubject(this.subject);
+    ThreadState state = this.securityService.bindSubject(this.subject);
     ClientUpdateMessage clientMessage = null;
     if(conflatable instanceof HAEventWrapper) {
       clientMessage = ((HAEventWrapper)conflatable).getClientUpdateMessage();
@@ -1673,7 +1678,7 @@ public class CacheClientProxy implements ClientSession {
     this._statistics.incMessagesReceived();
 
     // post process
-    if(GeodeSecurityUtil.needPostProcess()) {
+    if(this.securityService.needPostProcess()) {
       Object oldValue = clientMessage.getValue();
       Object newValue = GeodeSecurityUtil.postProcess(clientMessage.getRegionName(), clientMessage.getKeyOfInterest(), oldValue, clientMessage.valueIsObject());
       clientMessage.setLatestValue(newValue);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerStats.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerStats.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerStats.java
index 38537fa..626e075 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerStats.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerStats.java
@@ -716,176 +716,176 @@ public class CacheServerStats implements MessageStats {
     loadPerQueueId = this.stats.nameToId("loadPerQueue");
   }
 
-  public final void incAcceptThreadsCreated() {
+  public void incAcceptThreadsCreated() {
     this.stats.incInt(acceptThreadStartsId, 1);
   }
-  public final void incConnectionThreadsCreated() {
+  public void incConnectionThreadsCreated() {
     this.stats.incInt(connectionThreadStartsId, 1);
   }
-  public final void incAcceptsInProgress() {
+  public void incAcceptsInProgress() {
     this.stats.incInt(acceptsInProgressId, 1);
   }
-  public final void decAcceptsInProgress() {
+  public void decAcceptsInProgress() {
     this.stats.incInt(acceptsInProgressId, -1);
   }
-  public final void incConnectionThreads() {
+  public void incConnectionThreads() {
     this.stats.incInt(connectionThreadsId, 1);
   }
-  public final void decConnectionThreads() {
+  public void decConnectionThreads() {
     this.stats.incInt(connectionThreadsId, -1);
   }
 
-  public final void incAbandonedWriteRequests() {
+  public void incAbandonedWriteRequests() {
     this.stats.incInt(abandonedWriteRequestsId, 1);
   }
 
-  public final void incAbandonedReadRequests() {
+  public void incAbandonedReadRequests() {
     this.stats.incInt(abandonedReadRequestsId, 1);
   }
 
-  public final void incFailedConnectionAttempts() {
+  public void incFailedConnectionAttempts() {
     this.stats.incInt(failedConnectionAttemptsId, 1);
   }
 
-  public final void incConnectionsTimedOut() {
+  public void incConnectionsTimedOut() {
     this.stats.incInt(connectionsTimedOutId, 1);
   }
 
-  public final void incCurrentClientConnections()
+  public void incCurrentClientConnections()
   {
     this.stats.incInt(currentClientConnectionsId, 1);
   }
 
-  public final void decCurrentClientConnections()
+  public void decCurrentClientConnections()
   {
     this.stats.incInt(currentClientConnectionsId, -1);
   }
 
-  public final int getCurrentClientConnections()
+  public int getCurrentClientConnections()
   {
     return this.stats.getInt(currentClientConnectionsId);
   }
 
-  public final void incCurrentQueueConnections()
+  public void incCurrentQueueConnections()
   {
     this.stats.incInt(currentQueueConnectionsId, 1);
   }
 
-  public final void decCurrentQueueConnections()
+  public void decCurrentQueueConnections()
   {
     this.stats.incInt(currentQueueConnectionsId, -1);
   }
 
-  public final int getCurrentQueueConnections()
+  public int getCurrentQueueConnections()
   {
     return this.stats.getInt(currentQueueConnectionsId);
   }
 
-  public final void incCurrentClients()
+  public void incCurrentClients()
   {
     this.stats.incInt(currentClientsId, 1);
   }
 
-  public final void decCurrentClients()
+  public void decCurrentClients()
   {
     this.stats.incInt(currentClientsId, -1);
   }
 
-  public final void incThreadQueueSize() {
+  public void incThreadQueueSize() {
     this.stats.incInt(threadQueueSizeId, 1);
   }
-  public final void decThreadQueueSize() {
+  public void decThreadQueueSize() {
     this.stats.incInt(threadQueueSizeId, -1);
   }
 
-  public final void incReadGetRequestTime(long delta)
+  public void incReadGetRequestTime(long delta)
   {
     this.stats.incLong(readGetRequestTimeId, delta);
     this.stats.incInt(getRequestsId, 1);
   }
 
-  public final void incProcessGetTime(long delta)
+  public void incProcessGetTime(long delta)
   {
     this.stats.incLong(processGetTimeId, delta);
   }
 
-  public final void incWriteGetResponseTime(long delta)
+  public void incWriteGetResponseTime(long delta)
   {
     this.stats.incLong(writeGetResponseTimeId, delta);
     this.stats.incInt(getResponsesId, 1);
   }
 
-  public final void incReadPutAllRequestTime(long delta) {
+  public void incReadPutAllRequestTime(long delta) {
     this.stats.incLong(readPutAllRequestTimeId, delta);
     this.stats.incInt(putAllRequestsId, 1);
   }
 
-  public final void incProcessPutAllTime(long delta) {
+  public void incProcessPutAllTime(long delta) {
     this.stats.incLong(processPutAllTimeId, delta);
   }
 
-  public final void incWritePutAllResponseTime(long delta) {
+  public void incWritePutAllResponseTime(long delta) {
     this.stats.incLong(writePutAllResponseTimeId, delta);
     this.stats.incInt(putAllResponsesId, 1);
   }
 
-  public final void incReadRemoveAllRequestTime(long delta) {
+  public void incReadRemoveAllRequestTime(long delta) {
     this.stats.incLong(readRemoveAllRequestTimeId, delta);
     this.stats.incInt(removeAllRequestsId, 1);
   }
 
-  public final void incProcessRemoveAllTime(long delta) {
+  public void incProcessRemoveAllTime(long delta) {
     this.stats.incLong(processRemoveAllTimeId, delta);
   }
 
-  public final void incWriteRemoveAllResponseTime(long delta) {
+  public void incWriteRemoveAllResponseTime(long delta) {
     this.stats.incLong(writeRemoveAllResponseTimeId, delta);
     this.stats.incInt(removeAllResponsesId, 1);
   }
 
-  public final void incReadGetAllRequestTime(long delta) {
+  public void incReadGetAllRequestTime(long delta) {
     this.stats.incLong(readGetAllRequestTimeId, delta);
     this.stats.incInt(getAllRequestsId, 1);
   }
 
-  public final void incProcessGetAllTime(long delta) {
+  public void incProcessGetAllTime(long delta) {
     this.stats.incLong(processGetAllTimeId, delta);
   }
 
-  public final void incWriteGetAllResponseTime(long delta) {
+  public void incWriteGetAllResponseTime(long delta) {
     this.stats.incLong(writeGetAllResponseTimeId, delta);
     this.stats.incInt(getAllResponsesId, 1);
   }
 
-  public final void incReadPutRequestTime(long delta)
+  public void incReadPutRequestTime(long delta)
   {
     this.stats.incLong(readPutRequestTimeId, delta);
     this.stats.incInt(putRequestsId, 1);
   }
 
-  public final void incProcessPutTime(long delta)
+  public void incProcessPutTime(long delta)
   {
     this.stats.incLong(processPutTimeId, delta);
   }
 
-  public final void incWritePutResponseTime(long delta)
+  public void incWritePutResponseTime(long delta)
   {
     this.stats.incLong(writePutResponseTimeId, delta);
     this.stats.incInt(putResponsesId, 1);
   }
 
-  public final void incReadDestroyRequestTime(long delta)
+  public void incReadDestroyRequestTime(long delta)
   {
     this.stats.incLong(readDestroyRequestTimeId, delta);
     this.stats.incInt(destroyRequestsId, 1);
   }
 
-  public final void incProcessDestroyTime(long delta)
+  public void incProcessDestroyTime(long delta)
   {
     this.stats.incLong(processDestroyTimeId, delta);
   }
 
-  public final void incWriteDestroyResponseTime(long delta)
+  public void incWriteDestroyResponseTime(long delta)
   {
     this.stats.incLong(writeDestroyResponseTimeId, delta);
     this.stats.incInt(destroyResponsesId, 1);
@@ -893,18 +893,18 @@ public class CacheServerStats implements MessageStats {
   
   
 
-  public final void incReadInvalidateRequestTime(long delta)
+  public void incReadInvalidateRequestTime(long delta)
   {
 //    this.stats.incLong(readInvalidateRequestTimeId, delta);
 //    this.stats.incInt(invalidateRequestsId, 1);
   }
 
-  public final void incProcessInvalidateTime(long delta)
+  public void incProcessInvalidateTime(long delta)
   {
 //    this.stats.incLong(processInvalidateTimeId, delta);
   }
 
-  public final void incWriteInvalidateResponseTime(long delta)
+  public void incWriteInvalidateResponseTime(long delta)
   {
 //    this.stats.incLong(writeInvalidateResponseTimeId, delta);
 //    this.stats.incInt(invalidateResponsesId, 1);
@@ -912,18 +912,18 @@ public class CacheServerStats implements MessageStats {
 
   
 
-  public final void incReadSizeRequestTime(long delta)
+  public void incReadSizeRequestTime(long delta)
   {
 //    this.stats.incLong(readSizeRequestTimeId, delta);
 //    this.stats.incInt(sizeRequestsId, 1);
   }
 
-  public final void incProcessSizeTime(long delta)
+  public void incProcessSizeTime(long delta)
   {
 //    this.stats.incLong(processSizeTimeId, delta);
   }
 
-  public final void incWriteSizeResponseTime(long delta)
+  public void incWriteSizeResponseTime(long delta)
   {
 //    this.stats.incLong(writeSizeResponseTimeId, delta);
 //    this.stats.incInt(sizeResponsesId, 1);
@@ -931,148 +931,148 @@ public class CacheServerStats implements MessageStats {
 
   
 
-  public final void incReadQueryRequestTime(long delta) {
+  public void incReadQueryRequestTime(long delta) {
     this.stats.incLong(readQueryRequestTimeId, delta);
     this.stats.incInt(queryRequestsId, 1);
   }
 
-  public final void incProcessQueryTime(long delta) {
+  public void incProcessQueryTime(long delta) {
     this.stats.incLong(processQueryTimeId, delta);
   }
 
-  public final void incWriteQueryResponseTime(long delta) {
+  public void incWriteQueryResponseTime(long delta) {
     this.stats.incLong(writeQueryResponseTimeId, delta);
     this.stats.incInt(queryResponsesId, 1);
   }
 
-  public final void incProcessCreateCqTime(long delta) {
+  public void incProcessCreateCqTime(long delta) {
 	    //this.stats.incLong(processCreateCqTimeId, delta);
 	  }
-  public final void incProcessCloseCqTime(long delta) {
+  public void incProcessCloseCqTime(long delta) {
 	    //this.stats.incLong(processCloseCqTimeId, delta);
 	  }
-  public final void incProcessExecuteCqWithIRTime(long delta) {
+  public void incProcessExecuteCqWithIRTime(long delta) {
 	    //this.stats.incLong(processExecuteCqWithIRCqTimeId, delta);
 	  }
-public final void incProcessStopCqTime(long delta) {
+public void incProcessStopCqTime(long delta) {
 	    //this.stats.incLong(processStopCqTimeId, delta);
 	  }
-  public final void incProcessCloseClientCqsTime(long delta) {
+  public void incProcessCloseClientCqsTime(long delta) {
 	    //this.stats.incLong(processCloseClientCqsTimeId, delta);
 	  }
   
-  public final void incProcessGetCqStatsTime(long delta) {
+  public void incProcessGetCqStatsTime(long delta) {
 	    //this.stats.incLong(processGetCqStatsTimeId, delta);
 	  }
 
-  public final void incReadDestroyRegionRequestTime(long delta) {
+  public void incReadDestroyRegionRequestTime(long delta) {
     this.stats.incLong(readDestroyRegionRequestTimeId, delta);
     this.stats.incInt(destroyRegionRequestsId, 1);
   }
 
-  public final void incProcessDestroyRegionTime(long delta) {
+  public void incProcessDestroyRegionTime(long delta) {
     this.stats.incLong(processDestroyRegionTimeId, delta);
   }
 
-  public final void incWriteDestroyRegionResponseTime(long delta) {
+  public void incWriteDestroyRegionResponseTime(long delta) {
     this.stats.incLong(writeDestroyRegionResponseTimeId, delta);
     this.stats.incInt(destroyRegionResponsesId, 1);
   }
 
-  public final void incReadContainsKeyRequestTime(long delta) {
+  public void incReadContainsKeyRequestTime(long delta) {
     this.stats.incLong(readContainsKeyRequestTimeId, delta);
     this.stats.incInt(containsKeyRequestsId, 1);
   }
 
-  public final void incProcessContainsKeyTime(long delta) {
+  public void incProcessContainsKeyTime(long delta) {
     this.stats.incLong(processContainsKeyTimeId, delta);
   }
 
-  public final void incWriteContainsKeyResponseTime(long delta) {
+  public void incWriteContainsKeyResponseTime(long delta) {
     this.stats.incLong(writeContainsKeyResponseTimeId, delta);
     this.stats.incInt(containsKeyResponsesId, 1);
   }
 
-  public final void incReadClearRegionRequestTime(long delta)
+  public void incReadClearRegionRequestTime(long delta)
   {
     this.stats.incLong(readClearRegionRequestTimeId, delta);
     this.stats.incInt(clearRegionRequestsId, 1);
   }
 
-  public final void incProcessClearRegionTime(long delta)
+  public void incProcessClearRegionTime(long delta)
   {
     this.stats.incLong(processClearRegionTimeId, delta);
   }
 
-  public final void incWriteClearRegionResponseTime(long delta)
+  public void incWriteClearRegionResponseTime(long delta)
   {
     this.stats.incLong(writeClearRegionResponseTimeId, delta);
     this.stats.incInt(clearRegionResponsesId, 1);
   }
 
-  public final void incReadProcessBatchRequestTime(long delta) {
+  public void incReadProcessBatchRequestTime(long delta) {
     this.stats.incLong(readProcessBatchRequestTimeId, delta);
     this.stats.incInt(processBatchRequestsId, 1);
   }
 
-  public final void incWriteProcessBatchResponseTime(long delta)
+  public void incWriteProcessBatchResponseTime(long delta)
   {
     this.stats.incLong(writeProcessBatchResponseTimeId, delta);
     this.stats.incInt(processBatchResponsesId, 1);
   }
 
-  public final void incProcessBatchTime(long delta)
+  public void incProcessBatchTime(long delta)
   {
     this.stats.incLong(processBatchTimeId, delta);
   }
 
-  public final void incBatchSize(long size)
+  public void incBatchSize(long size)
   {
     this.stats.incLong(batchSizeId, size);
   }
 
-  public final void incReadClientNotificationRequestTime(long delta)
+  public void incReadClientNotificationRequestTime(long delta)
   {
     this.stats.incLong(readClientNotificationRequestTimeId, delta);
     this.stats.incInt(clientNotificationRequestsId, 1);
   }
 
-  public final void incProcessClientNotificationTime(long delta)
+  public void incProcessClientNotificationTime(long delta)
   {
     this.stats.incLong(processClientNotificationTimeId, delta);
   }
 
-  public final void incReadUpdateClientNotificationRequestTime(long delta)
+  public void incReadUpdateClientNotificationRequestTime(long delta)
   {
     this.stats.incLong(readUpdateClientNotificationRequestTimeId, delta);
     this.stats.incInt(updateClientNotificationRequestsId, 1);
   }
 
-  public final void incProcessUpdateClientNotificationTime(long delta)
+  public void incProcessUpdateClientNotificationTime(long delta)
   {
     this.stats.incLong(processUpdateClientNotificationTimeId, delta);
   }
 
-  public final void incReadCloseConnectionRequestTime(long delta)
+  public void incReadCloseConnectionRequestTime(long delta)
   {
     this.stats.incLong(readCloseConnectionRequestTimeId, delta);
     this.stats.incInt(closeConnectionRequestsId, 1);
   }
 
-  public final void incProcessCloseConnectionTime(long delta)
+  public void incProcessCloseConnectionTime(long delta)
   {
     this.stats.incLong(processCloseConnectionTimeId, delta);
   }
 
-  public final void incOutOfOrderBatchIds()
+  public void incOutOfOrderBatchIds()
   {
     this.stats.incInt(outOfOrderBatchIdsId, 1);
   }
 
-  public final void incReceivedBytes(long v) {
+  public void incReceivedBytes(long v) {
     this.stats.incLong(receivedBytesId, v);
   }
-  public final void incSentBytes(long v) {
+  public void incSentBytes(long v) {
     this.stats.incLong(sentBytesId, v);
   }
   public void incMessagesBeingReceived(int bytes) {
@@ -1088,46 +1088,46 @@ public final void incProcessStopCqTime(long delta) {
     }
   }
 
-  public final void incReadClientReadyRequestTime(long delta) {
+  public void incReadClientReadyRequestTime(long delta) {
     this.stats.incLong(readClientReadyRequestTimeId, delta);
     this.stats.incInt(clientReadyRequestsId, 1);
   }
 
-  public final void incProcessClientReadyTime(long delta) {
+  public void incProcessClientReadyTime(long delta) {
     this.stats.incLong(processClientReadyTimeId, delta);
   }
 
-  public final void incWriteClientReadyResponseTime(long delta)
+  public void incWriteClientReadyResponseTime(long delta)
   {
     this.stats.incLong(writeClientReadyResponseTimeId, delta);
     this.stats.incInt(clientReadyResponsesId, 1);
   }
   
-  public final void setLoad(ServerLoad load) {
+  public void setLoad(ServerLoad load) {
     this.stats.setDouble(connectionLoadId, load.getConnectionLoad());
     this.stats.setDouble(queueLoadId, load.getSubscriptionConnectionLoad());
     this.stats.setDouble(loadPerConnectionId, load.getLoadPerConnection());
     this.stats.setDouble(loadPerQueueId, load.getLoadPerSubscriptionConnection());
   }
 
-  public final double getQueueLoad() {
+  public double getQueueLoad() {
     return this.stats.getDouble(queueLoadId);
   }
-  public final double getLoadPerQueue() {
+  public double getLoadPerQueue() {
     return this.stats.getDouble(loadPerQueueId);
   }
-  public final double getConnectionLoad() {
+  public double getConnectionLoad() {
     return this.stats.getDouble(connectionLoadId);
   }
-  public final double getLoadPerConnection() {
+  public double getLoadPerConnection() {
     return this.stats.getDouble(loadPerConnectionId);
   }
   
- public final int getProcessBatchRequests(){
+ public int getProcessBatchRequests(){
    return this.stats.getInt(processBatchRequestsId);
  }
   
-  public final void close() {
+  public void close() {
     this.stats.close();
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/HandShake.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/HandShake.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/HandShake.java
index e501531..8f9c9c7 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/HandShake.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/HandShake.java
@@ -92,6 +92,8 @@ import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.InternalLogWriter;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
+import com.gemstone.gemfire.internal.security.IntegratedSecurityService;
+import com.gemstone.gemfire.internal.security.SecurityService;
 import com.gemstone.gemfire.pdx.internal.PeerTypeRegistration;
 import com.gemstone.gemfire.security.AuthInitialize;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
@@ -118,7 +120,9 @@ public class HandShake implements ClientHandShake
   protected static final byte REPLY_WAN_CREDENTIALS = (byte)65;
   
   protected static final byte REPLY_AUTH_NOT_REQUIRED = (byte)66;
-
+  
+  private static SecurityService securityService = IntegratedSecurityService.getSecurityService();
+  
   private byte code;
   private int clientReadTimeout = PoolFactory.DEFAULT_READ_TIMEOUT;
 
@@ -899,7 +903,7 @@ public class HandShake implements ClientHandShake
       throws GemFireSecurityException, IOException {
 
     Properties credentials = null;
-    boolean requireAuthentication = GeodeSecurityUtil.isClientSecurityRequired();
+    boolean requireAuthentication = securityService.isClientSecurityRequired();
     try {
       byte secureMode = dis.readByte();
       if (secureMode == CREDENTIALS_NONE) {
@@ -1161,7 +1165,7 @@ public class HandShake implements ClientHandShake
     // non-blank setting for DH symmetric algo, or this is a server
     // that has authenticator defined.
     if ((dhSKAlgo != null && dhSKAlgo.length() > 0)
-        || GeodeSecurityUtil.isClientSecurityRequired()) {
+        || securityService.isClientSecurityRequired()) {
       KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DH");
       DHParameterSpec dhSpec = new DHParameterSpec(dhP, dhG, dhL);
       keyGen.initialize(dhSpec);
@@ -1632,7 +1636,7 @@ public class HandShake implements ClientHandShake
       DataOutputStream dos, DistributedSystem system)
       throws GemFireSecurityException, IOException {
 
-    boolean requireAuthentication = GeodeSecurityUtil.isClientSecurityRequired();
+    boolean requireAuthentication = securityService.isClientSecurityRequired();
     Properties credentials = null;
     try {
       byte secureMode = dis.readByte();
@@ -1793,7 +1797,7 @@ public class HandShake implements ClientHandShake
       if(AcceptorImpl.isIntegratedSecurity()){
         String username = credentials.getProperty("security-username");
         String password = credentials.getProperty("security-password");
-        return GeodeSecurityUtil.login(username, password);
+        return securityService.login(username, password);
       }
       else {
         Method instanceGetter = ClassLoadUtil.methodFromName(authenticatorMethod);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/Part.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/Part.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/Part.java
index 42b7662..f04d344 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/Part.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/Part.java
@@ -16,16 +16,20 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
-import com.gemstone.gemfire.internal.*;
-import com.gemstone.gemfire.internal.offheap.AddressableMemoryManager;
-import com.gemstone.gemfire.internal.offheap.StoredObject;
-
-import java.io.*;
-import java.nio.*;
-import java.nio.channels.*;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.SocketChannel;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import com.gemstone.gemfire.internal.Assert;
+import com.gemstone.gemfire.internal.DSCODE;
+import com.gemstone.gemfire.internal.HeapDataOutputStream;
+import com.gemstone.gemfire.internal.Version;
+import com.gemstone.gemfire.internal.offheap.AddressableMemoryManager;
+import com.gemstone.gemfire.internal.offheap.StoredObject;
+
 /**
  * Represents one unit of information (essentially a <code>byte</code>
  * array) in the wire protocol.  Each server connection runs in its

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f93b7485/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ServerConnection.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ServerConnection.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ServerConnection.java
index bdbef09..77a894a 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ServerConnection.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ServerConnection.java
@@ -65,7 +65,8 @@ import com.gemstone.gemfire.internal.logging.LogService;
 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.internal.security.IntegratedSecurityService;
+import com.gemstone.gemfire.internal.security.SecurityService;
 import com.gemstone.gemfire.internal.util.Breadcrumbs;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.AuthenticationRequiredException;
@@ -92,6 +93,7 @@ public class ServerConnection implements Runnable {
  // private static final CM commands = CFactory.createCM();
   private Map commands;
 
+  private SecurityService securityService = IntegratedSecurityService.getSecurityService();
 
   final protected CacheServerStats stats;
 
@@ -776,7 +778,7 @@ public class ServerConnection implements Runnable {
           long uniqueId = getUniqueId();
           Subject subject = this.clientUserAuths.getSubject(uniqueId);
           if(subject!=null) {
-            threadState = GeodeSecurityUtil.bindSubject(subject);
+            threadState = securityService.bindSubject(subject);
           }
         }
 

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/ClearRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ClearRegion.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ClearRegion.java
index 093a322..8cea8fa 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ClearRegion.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ClearRegion.java
@@ -37,8 +37,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;
 
 public class ClearRegion extends BaseCommand {
 
@@ -104,8 +104,6 @@ public class ClearRegion extends BaseCommand {
       servConn.setAsTrue(RESPONDED);
       return;
     }
-    // Clear the region
-    GeodeSecurityUtil.authorizeRegionWrite(regionName);
 
     ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
     long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
@@ -113,6 +111,9 @@ public class ClearRegion extends BaseCommand {
     EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
 
     try {
+      // Clear the region
+      this.securityService.authorizeRegionWrite(regionName);
+
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();
       if (authzRequest != null) {
         RegionClearOperationContext clearContext = authzRequest.clearAuthorize(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/ContainsKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ContainsKey.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ContainsKey.java
index 10a9067..fb61e03 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ContainsKey.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ContainsKey.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;
@@ -35,24 +32,18 @@ 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.NotAuthorizedException;
 
-
 public class ContainsKey extends BaseCommand {
 
   private final static ContainsKey singleton = new ContainsKey();
 
-  private ContainsKey() {
-  }
-
   public static Command getCommand() {
     return singleton;
   }
 
   private static void writeContainsKeyResponse(boolean containsKey, Message origMsg, ServerConnection servConn)
     throws IOException {
-    LogWriterI18n logger = servConn.getLogWriter();
     Message responseMsg = servConn.getResponseMessage();
     responseMsg.setMessageType(MessageType.RESPONSE);
     responseMsg.setNumberOfParts(1);
@@ -63,11 +54,11 @@ public class ContainsKey extends BaseCommand {
 
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
-    Part regionNamePart = null, keyPart = null;
+    Part regionNamePart = null;
+    Part keyPart = null;
     String regionName = null;
     Object key = null;
-    //StringBuffer errMessage = new StringBuffer();
-    CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
+
     CacheServerStats stats = servConn.getCacheServerStats();
 
     servConn.setAsTrue(REQUIRES_RESPONSE);
@@ -109,7 +100,8 @@ public class ContainsKey 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.ContainsKey_WAS_NOT_FOUND_DURING_CONTAINSKEY_REQUEST.toLocalizedString();
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -117,7 +109,13 @@ public class ContainsKey extends BaseCommand {
       return;
     }
 
-    GeodeSecurityUtil.authorizeRegionRead(regionName, key.toString());
+    try {
+      this.securityService.authorizeRegionRead(regionName, key.toString());
+    } catch (NotAuthorizedException ex) {
+      writeException(msg, ex, false, servConn);
+      servConn.setAsTrue(RESPONDED);
+      return;
+    }
 
     AuthorizeRequest authzRequest = servConn.getAuthzRequest();
     if (authzRequest != null) {

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/ContainsKey66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ContainsKey66.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ContainsKey66.java
index 1d6c52d..53e691f 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ContainsKey66.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/ContainsKey66.java
@@ -25,7 +25,6 @@ import com.gemstone.gemfire.cache.client.internal.ContainsKeyOp;
 import com.gemstone.gemfire.distributed.internal.DistributionStats;
 import com.gemstone.gemfire.i18n.LogWriterI18n;
 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;
@@ -36,17 +35,12 @@ 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.NotAuthorizedException;
 
-
 public class ContainsKey66 extends BaseCommand {
 
   private final static ContainsKey66 singleton = new ContainsKey66();
 
-  private ContainsKey66() {
-  }
-
   public static Command getCommand() {
     return singleton;
   }
@@ -68,8 +62,6 @@ public class ContainsKey66 extends BaseCommand {
     String regionName = null;
     Object key = null;
     ContainsKeyOp.MODE mode;
-    //StringBuffer errMessage = new StringBuffer();
-    CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     CacheServerStats stats = servConn.getCacheServerStats();
 
     servConn.setAsTrue(REQUIRES_RESPONSE);
@@ -112,7 +104,7 @@ public class ContainsKey66 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.ContainsKey_WAS_NOT_FOUND_DURING_CONTAINSKEY_REQUEST.toLocalizedString();
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -120,7 +112,13 @@ public class ContainsKey66 extends BaseCommand {
       return;
     }
 
-    GeodeSecurityUtil.authorizeRegionRead(regionName, key.toString());
+    try {
+      this.securityService.authorizeRegionRead(regionName, key.toString());
+    } catch (NotAuthorizedException ex) {
+      writeException(msg, ex, false, servConn);
+      servConn.setAsTrue(RESPONDED);
+      return;
+    }
 
     AuthorizeRequest authzRequest = servConn.getAuthzRequest();
     if (authzRequest != null) {

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/CreateRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/CreateRegion.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/CreateRegion.java
index 7889a72..75c7214 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/CreateRegion.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/CreateRegion.java
@@ -23,7 +23,6 @@ import java.io.IOException;
 
 import com.gemstone.gemfire.cache.AttributesFactory;
 import com.gemstone.gemfire.cache.Region;
-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;
@@ -33,10 +32,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.security.NotAuthorizedException;
 
-
 public class CreateRegion extends BaseCommand {
 
   private final static CreateRegion singleton = new CreateRegion();
@@ -45,14 +42,10 @@ public class CreateRegion extends BaseCommand {
     return singleton;
   }
 
-  private CreateRegion() {
-  }
-
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
     Part regionNamePart = null;
     String regionName = null;
-    CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     servConn.setAsTrue(REQUIRES_RESPONSE);
     // bserverStats.incLong(readDestroyRequestTimeId,
     // DistributionStats.getStatTime() - start);
@@ -88,7 +81,7 @@ public class CreateRegion extends BaseCommand {
       return;
     }
 
-    Region parentRegion = crHelper.getRegion(parentRegionName);
+    Region parentRegion = servConn.getCache().getRegion(parentRegionName);
     if (parentRegion == null) {
       String reason = LocalizedStrings.CreateRegion__0_WAS_NOT_FOUND_DURING_SUBREGION_CREATION_REQUEST.toLocalizedString(parentRegionName);
       writeRegionDestroyedEx(msg, parentRegionName, reason, servConn);
@@ -96,7 +89,13 @@ public class CreateRegion extends BaseCommand {
       return;
     }
 
-    GeodeSecurityUtil.authorizeDataManage();
+    try {
+      this.securityService.authorizeDataManage();
+    } catch (NotAuthorizedException ex) {
+      writeException(msg, ex, false, servConn);
+      servConn.setAsTrue(RESPONDED);
+      return;
+    }
 
     AuthorizeRequest authzRequest = servConn.getAuthzRequest();
     if (authzRequest != null) {

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/Destroy.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Destroy.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Destroy.java
index cc99962..4e14617 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Destroy.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Destroy.java
@@ -14,10 +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;
@@ -44,17 +40,12 @@ 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 Destroy extends BaseCommand {
 
   private final static Destroy singleton = new Destroy();
 
-  private Destroy() {
-  }
-
   public static Command getCommand() {
     return singleton;
   }
@@ -69,7 +60,6 @@ public class Destroy 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);
 
@@ -123,7 +113,7 @@ public class Destroy extends BaseCommand {
       return;
     }
 
-    LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
     if (region == null) {
       String reason = LocalizedStrings.Destroy__0_WAS_NOT_FOUND_DURING_DESTROY_REQUEST.toLocalizedString(regionName);
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -137,10 +127,10 @@ public class Destroy extends BaseCommand {
     long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
     EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
 
-    // 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) {
         // TODO SW: This is to handle DynamicRegionFactory destroy

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/Destroy65.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Destroy65.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Destroy65.java
index 41cc0be..77682a1 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Destroy65.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Destroy65.java
@@ -17,11 +17,11 @@
 /**
  *
  */
-
 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.DynamicRegionFactory;
 import com.gemstone.gemfire.cache.EntryNotFoundException;
@@ -48,18 +48,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 Destroy65 extends BaseCommand {
 
   private final static Destroy65 singleton = new Destroy65();
 
-  protected Destroy65() {
-  }
-
   public static Command getCommand() {
     return singleton;
   }
@@ -191,7 +186,7 @@ public class Destroy65 extends BaseCommand {
       return;
     }
 
-    LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
+    LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
     if (region == null) {
       String reason = LocalizedStrings.Destroy__0_WAS_NOT_FOUND_DURING_DESTROY_REQUEST.toLocalizedString(regionName);
       writeRegionDestroyedEx(msg, regionName, reason, servConn);
@@ -199,9 +194,6 @@ public class Destroy65 extends BaseCommand {
       return;
     }
 
-    // for integrated security
-    GeodeSecurityUtil.authorizeRegionWrite(regionName, key.toString());
-
     // Destroy the entry
     ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
     long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
@@ -227,6 +219,9 @@ public class Destroy65 extends BaseCommand {
     }
 
     try {
+      // for integrated security
+      this.securityService.authorizeRegionWrite(regionName, key.toString());
+
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();
       if (authzRequest != null) {
         // TODO SW: This is to handle DynamicRegionFactory destroy



Mime
View raw message