geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [07/10] geode git commit: milestone
Date Thu, 01 Jun 2017 19:05:37 GMT
milestone


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

Branch: refs/heads/feature/GEODE-2632-19
Commit: 13b94704b0fc59e761306ed31f506b2b7fa3463e
Parents: d1ec508
Author: Kirk Lund <klund@apache.org>
Authored: Wed May 31 16:13:20 2017 -0700
Committer: Kirk Lund <klund@apache.org>
Committed: Thu Jun 1 11:46:03 2017 -0700

----------------------------------------------------------------------
 .../membership/gms/auth/GMSAuthenticator.java   |  69 ++-
 .../geode/internal/cache/CacheServerImpl.java   |   4 +
 .../geode/internal/cache/GemFireCacheImpl.java  |  14 +-
 .../geode/internal/cache/InternalCache.java     |   3 +
 .../geode/internal/cache/tier/Command.java      |   3 +-
 .../internal/cache/tier/CommandContext.java     |  33 ++
 .../cache/tier/sockets/AcceptorImpl.java        |   5 +-
 .../cache/tier/sockets/BaseCommand.java         |  11 +-
 .../cache/tier/sockets/BaseCommandQuery.java    |  66 ++-
 .../cache/tier/sockets/CacheClientNotifier.java |  39 +-
 .../cache/tier/sockets/CacheClientProxy.java    |   6 +-
 .../cache/tier/sockets/CommandContextImpl.java  |  63 +++
 .../internal/cache/tier/sockets/HandShake.java  |  30 +-
 .../cache/tier/sockets/ServerConnection.java    |  43 +-
 .../tier/sockets/ServerHandShakeProcessor.java  |   9 +-
 .../cache/tier/sockets/command/AddPdxEnum.java  |   3 +-
 .../cache/tier/sockets/command/AddPdxType.java  |   3 +-
 .../cache/tier/sockets/command/ClearRegion.java |   5 +-
 .../cache/tier/sockets/command/ClientReady.java |   3 +-
 .../tier/sockets/command/CloseConnection.java   |   3 +-
 .../tier/sockets/command/CommitCommand.java     |   6 +-
 .../cache/tier/sockets/command/ContainsKey.java |   7 +-
 .../tier/sockets/command/ContainsKey66.java     |   8 +-
 .../tier/sockets/command/CreateRegion.java      |   8 +-
 .../cache/tier/sockets/command/Default.java     |   3 +-
 .../cache/tier/sockets/command/Destroy.java     |   5 +-
 .../cache/tier/sockets/command/Destroy65.java   |   7 +-
 .../tier/sockets/command/DestroyRegion.java     |   7 +-
 .../tier/sockets/command/ExecuteFunction.java   |  53 +--
 .../tier/sockets/command/ExecuteFunction65.java |  59 +--
 .../tier/sockets/command/ExecuteFunction66.java |  75 ++--
 .../tier/sockets/command/ExecuteFunction70.java |   5 +-
 .../sockets/command/ExecuteRegionFunction.java  |  57 +--
 .../command/ExecuteRegionFunction61.java        |  54 +--
 .../command/ExecuteRegionFunction65.java        |  77 ++--
 .../command/ExecuteRegionFunction66.java        |  89 ++--
 .../command/ExecuteRegionFunctionSingleHop.java |  79 ++--
 .../sockets/command/GatewayReceiverCommand.java |   4 +-
 .../cache/tier/sockets/command/Get70.java       |   7 +-
 .../cache/tier/sockets/command/GetAll.java      |  13 +-
 .../cache/tier/sockets/command/GetAll651.java   |  15 +-
 .../cache/tier/sockets/command/GetAll70.java    |  13 +-
 .../sockets/command/GetAllWithCallback.java     |  15 +-
 .../command/GetClientPRMetadataCommand.java     |   3 +-
 .../command/GetClientPRMetadataCommand66.java   |   3 +-
 .../GetClientPartitionAttributesCommand.java    |   3 +-
 .../GetClientPartitionAttributesCommand66.java  |   3 +-
 .../sockets/command/GetFunctionAttribute.java   |   3 +-
 .../tier/sockets/command/GetPDXEnumById.java    |   3 +-
 .../tier/sockets/command/GetPDXIdForEnum.java   |   3 +-
 .../tier/sockets/command/GetPDXIdForType.java   |   3 +-
 .../tier/sockets/command/GetPDXTypeById.java    |   3 +-
 .../tier/sockets/command/GetPdxEnums70.java     |   3 +-
 .../tier/sockets/command/GetPdxTypes70.java     |   3 +-
 .../cache/tier/sockets/command/Invalid.java     |   3 +-
 .../cache/tier/sockets/command/Invalidate.java  |   7 +-
 .../cache/tier/sockets/command/KeySet.java      |   5 +-
 .../cache/tier/sockets/command/MakePrimary.java |   4 +-
 .../tier/sockets/command/ManagementCommand.java |   3 +-
 .../cache/tier/sockets/command/PeriodicAck.java |   4 +-
 .../cache/tier/sockets/command/Ping.java        |   6 +-
 .../cache/tier/sockets/command/Put.java         |   8 +-
 .../cache/tier/sockets/command/Put61.java       |  10 +-
 .../cache/tier/sockets/command/Put65.java       |   7 +-
 .../cache/tier/sockets/command/PutAll.java      |  10 +-
 .../cache/tier/sockets/command/PutAll70.java    |  11 +-
 .../cache/tier/sockets/command/PutAll80.java    |  10 +-
 .../sockets/command/PutUserCredentials.java     |   3 +-
 .../cache/tier/sockets/command/Query.java       |   5 +-
 .../cache/tier/sockets/command/Query651.java    |   5 +-
 .../command/RegisterDataSerializers.java        |   4 +-
 .../sockets/command/RegisterInstantiators.java  |   4 +-
 .../tier/sockets/command/RegisterInterest.java  |   7 +-
 .../sockets/command/RegisterInterest61.java     |  10 +-
 .../sockets/command/RegisterInterestList.java   |  25 +-
 .../sockets/command/RegisterInterestList61.java |  23 +-
 .../sockets/command/RegisterInterestList66.java |  61 +--
 .../cache/tier/sockets/command/RemoveAll.java   |  12 +-
 .../tier/sockets/command/RemoveUserAuth.java    |   3 +-
 .../cache/tier/sockets/command/Request.java     |   8 +-
 .../tier/sockets/command/RequestEventValue.java |   3 +-
 .../tier/sockets/command/RollbackCommand.java   |   3 +-
 .../cache/tier/sockets/command/Size.java        |   9 +-
 .../tier/sockets/command/TXFailoverCommand.java |   3 +-
 .../command/TXSynchronizationCommand.java       |   4 +-
 .../sockets/command/UnregisterInterest.java     |  11 +-
 .../sockets/command/UnregisterInterestList.java |   5 +-
 .../command/UpdateClientNotification.java       |   3 +-
 .../internal/cache/xmlcache/CacheCreation.java  |   7 +
 .../apache/geode/internal/lang/Initializer.java |   2 +-
 .../security/CustomSecurityService.java         | 205 +++++++++
 .../security/DisabledSecurityService.java       | 208 +++++++++
 .../security/EnabledSecurityService.java        | 418 +++++++++++++++++++
 .../security/LegacySecurityService.java         | 218 ++++++++++
 .../internal/security/SecurityService.java      |  39 +-
 .../security/SecurityServiceFactory.java        | 136 ++++++
 .../internal/security/SecurityServiceType.java  |  28 ++
 .../security/shiro/ConfigInitialization.java    |  46 ++
 .../security/shiro/JMXShiroAuthenticator.java   |  18 +-
 .../geode/management/cli/CommandService.java    |   3 +-
 .../management/internal/ManagementAgent.java    |  11 +-
 .../internal/SystemManagementService.java       |   2 +-
 .../cli/commands/AbstractCommandsSupport.java   |   1 -
 .../CreateAlterDestroyRegionCommands.java       |   4 +-
 .../internal/cli/commands/DataCommands.java     |  25 +-
 .../internal/cli/commands/DeployCommands.java   |   2 +
 .../internal/cli/commands/IndexCommands.java    |  10 +-
 .../cli/functions/DataCommandFunction.java      | 118 +-----
 .../internal/cli/functions/SelectExecStep.java  | 139 ++++++
 .../internal/cli/remote/CommandProcessor.java   |   8 +-
 .../cli/remote/MemberCommandService.java        |  18 +-
 .../internal/security/AccessControlMBean.java   |   6 +-
 .../internal/security/MBeanServerWrapper.java   |  20 +-
 .../controllers/AbstractCommandsController.java |   8 +-
 .../support/LoginHandlerInterceptor.java        |  30 +-
 .../apache/geode/security/PostProcessor.java    |   2 +-
 .../cache/ha/BlockingHARegionJUnitTest.java     |   9 +-
 .../tier/sockets/ServerConnectionTest.java      |   7 +-
 .../tier/sockets/command/ContainsKey66Test.java |  10 +-
 .../tier/sockets/command/ContainsKeyTest.java   |  10 +-
 .../tier/sockets/command/CreateRegionTest.java  |  10 +-
 .../tier/sockets/command/Destroy65Test.java     |  10 +-
 .../tier/sockets/command/DestroyRegionTest.java |  10 +-
 .../cache/tier/sockets/command/DestroyTest.java |  10 +-
 .../sockets/command/ExecuteFunction65Test.java  |  11 +-
 .../sockets/command/ExecuteFunction66Test.java  |  10 +-
 .../sockets/command/ExecuteFunctionTest.java    |  11 +-
 .../cache/tier/sockets/command/Get70Test.java   |  10 +-
 .../tier/sockets/command/GetAll651Test.java     |  10 +-
 .../tier/sockets/command/GetAll70Test.java      |  10 +-
 .../cache/tier/sockets/command/GetAllTest.java  |  10 +-
 .../sockets/command/GetAllWithCallbackTest.java |  10 +-
 ...tClientPartitionAttributesCommand66Test.java |   2 +-
 ...GetClientPartitionAttributesCommandTest.java |   4 +-
 .../tier/sockets/command/InvalidateTest.java    |  10 +-
 .../cache/tier/sockets/command/KeySetTest.java  |  10 +-
 .../cache/tier/sockets/command/Put61Test.java   |  10 +-
 .../cache/tier/sockets/command/Put65Test.java   |  10 +-
 .../cache/tier/sockets/command/PutTest.java     |  10 +-
 .../sockets/command/RegisterInterest61Test.java |  10 +-
 .../command/RegisterInterestList61Test.java     |  10 +-
 .../command/RegisterInterestList66Test.java     |  10 +-
 .../command/RegisterInterestListTest.java       |  10 +-
 .../sockets/command/RegisterInterestTest.java   |  10 +-
 .../tier/sockets/command/RemoveAllTest.java     |  10 +-
 .../cache/tier/sockets/command/RequestTest.java |  10 +-
 .../sockets/command/UnregisterInterestTest.java |  10 +-
 .../internal/lang/InitializerJUnitTest.java     |   2 +-
 .../internal/security/FakePostProcessor.java    | 101 +++++
 .../internal/security/FakeSecurityManager.java  | 104 +++++
 .../security/IntegratedSecurityServiceTest.java |   2 +-
 .../security/SecurityServiceFactoryTest.java    | 226 ++++++++++
 ...atedSecurityServiceWithIniFileJUnitTest.java |   6 +-
 .../CacheFactoryWithSecurityObjectTest.java     |  16 +-
 .../PDXGfshPostProcessorOnRemoteServerTest.java |   2 +-
 .../security/PDXPostProcessorDUnitTest.java     |   9 +-
 .../test/dunit/rules/ServerStarterRule.java     |   8 +-
 .../cache/tier/sockets/command/CloseCQ.java     |  14 +-
 .../cache/tier/sockets/command/ExecuteCQ.java   |   9 +-
 .../cache/tier/sockets/command/ExecuteCQ61.java |  12 +-
 .../cache/tier/sockets/command/GetCQStats.java  |  11 +-
 .../tier/sockets/command/GetDurableCQs.java     |   7 +-
 .../cache/tier/sockets/command/MonitorCQ.java   |  13 +-
 .../cache/tier/sockets/command/StopCQ.java      |  13 +-
 .../security/CQPDXPostProcessorDUnitTest.java   |   2 +-
 .../internal/cli/LuceneIndexCommands.java       |   8 +-
 .../apache/geode/tools/pulse/tests/Server.java  |  18 +-
 .../tools/pulse/tests/rules/ServerRule.java     |   6 +-
 .../apache/geode/cache/util/AutoBalancer.java   |   2 +-
 .../security/GeodeAuthenticationProvider.java   |  24 +-
 .../web/security/RestSecurityConfiguration.java |   4 +-
 .../web/security/RestSecurityService.java       |  16 +-
 .../web/security/SecurityServiceProvider.java   |  20 +
 ...andlerInterceptorRequestHeaderJUnitTest.java |   3 +-
 174 files changed, 3011 insertions(+), 1086 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/auth/GMSAuthenticator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/auth/GMSAuthenticator.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/auth/GMSAuthenticator.java
index ab0ca6b..c4d0e79 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/auth/GMSAuthenticator.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/auth/GMSAuthenticator.java
@@ -14,33 +14,40 @@
  */
 package org.apache.geode.distributed.internal.membership.gms.auth;
 
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.apache.geode.internal.i18n.LocalizedStrings.*;
-
-import java.security.Principal;
-import java.util.Properties;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_PEER_AUTHENTICATOR;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_PEER_AUTH_INIT;
+import static org.apache.geode.internal.i18n.LocalizedStrings.AUTH_PEER_AUTHENTICATION_FAILED;
+import static org.apache.geode.internal.i18n.LocalizedStrings.AUTH_PEER_AUTHENTICATION_FAILED_WITH_EXCEPTION;
+import static org.apache.geode.internal.i18n.LocalizedStrings.AUTH_PEER_AUTHENTICATION_MISSING_CREDENTIALS;
+import static org.apache.geode.internal.i18n.LocalizedStrings.HandShake_FAILED_TO_ACQUIRE_AUTHENTICATOR_OBJECT;
 
 import org.apache.commons.lang.StringUtils;
-
 import org.apache.geode.LogWriter;
 import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.distributed.internal.membership.NetView;
 import org.apache.geode.distributed.internal.membership.gms.Services;
 import org.apache.geode.distributed.internal.membership.gms.interfaces.Authenticator;
+import org.apache.geode.internal.cache.CacheConfig;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.tier.sockets.HandShake;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.InternalLogWriter;
-import org.apache.geode.internal.security.IntegratedSecurityService;
 import org.apache.geode.internal.security.SecurityService;
+import org.apache.geode.internal.security.SecurityServiceFactory;
 import org.apache.geode.security.AuthenticationFailedException;
 import org.apache.geode.security.GemFireSecurityException;
 
+import java.security.Principal;
+import java.util.Properties;
+import java.util.concurrent.atomic.AtomicReference;
+
 public class GMSAuthenticator implements Authenticator {
 
   private Services services;
   private Properties securityProps;
-  private SecurityService securityService = IntegratedSecurityService.getSecurityService();
 
   @Override
   public void init(Services s) {
@@ -98,6 +105,8 @@ public class GMSAuthenticator implements Authenticator {
    */
   String authenticate(DistributedMember member, Properties credentials, Properties secProps)
       throws AuthenticationFailedException {
+    SecurityService securityService = getSecurityService();
+
     // For older systems, locator might be started without cache, so secureService may not be
     // initialized here. We need to check
     // if the passed in secProps has peer authenticator or not
@@ -116,9 +125,9 @@ public class GMSAuthenticator implements Authenticator {
 
     String failMsg = null;
     try {
-      if (this.securityService.isIntegratedSecurity()) {
-        this.securityService.login(credentials);
-        this.securityService.authorizeClusterManage();
+      if (securityService.isIntegratedSecurity()) {
+        securityService.login(credentials);
+        securityService.authorizeClusterManage();
       } else {
         invokeAuthenticator(secProps, member, credentials);
       }
@@ -145,10 +154,9 @@ public class GMSAuthenticator implements Authenticator {
 
       LogWriter logWriter = this.services.getLogWriter();
       LogWriter securityLogWriter = this.services.getSecurityLogWriter();
-      auth.init(this.securityProps, logWriter, securityLogWriter); // this.securityProps contains
-                                                                   // security-ldap-basedn but
-                                                                   // security-ldap-baseDomainName
-                                                                   // is expected
+
+      // this.securityProps contains security-ldap-basedn but security-ldap-baseDomainName is expected
+      auth.init(this.securityProps, logWriter, securityLogWriter);
       return auth.authenticate(credentials, member);
 
     } catch (GemFireSecurityException gse) {
@@ -202,4 +210,35 @@ public class GMSAuthenticator implements Authenticator {
 
   @Override
   public void emergencyClose() {}
+
+  private final AtomicReference<SecurityService> securityServiceRef = new AtomicReference<>();
+
+  /**
+   * Terrible mess. It would be nice if we could create SecurityService BEFORE this class.
+   */
+  private SecurityService getSecurityService() {
+    SecurityService securityService = this.securityServiceRef.get();
+    if (securityService == null) {
+      synchronized (this.securityServiceRef) {
+        securityService = this.securityServiceRef.get();
+        if (securityService == null) {
+          InternalCache cache = GemFireCacheImpl.getInstance();
+          if (cache != null) {
+            securityService = cache.getSecurityService();
+          }
+        }
+        if (securityService == null) {
+          InternalDistributedSystem system = InternalDistributedSystem.getConnectedInstance();
+          if (system != null) {
+            securityService = SecurityServiceFactory.create(new CacheConfig(), system.getConfig());
+          } else {
+            securityService = SecurityServiceFactory.create(null, null);
+          }
+        }
+        this.securityServiceRef.set(securityService);
+      }
+    }
+    return securityService;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
index 670c697..7d4b6d4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
@@ -72,6 +72,7 @@ import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
+import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.management.membership.ClientMembership;
 import org.apache.geode.management.membership.ClientMembershipListener;
 
@@ -88,6 +89,8 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
   private static final int FORCE_LOAD_UPDATE_FREQUENCY = getInteger(
       DistributionConfig.GEMFIRE_PREFIX + "BridgeServer.FORCE_LOAD_UPDATE_FREQUENCY", 10);
 
+  private final SecurityService securityService;
+
   /** The acceptor that does the actual serving */
   private volatile AcceptorImpl acceptor;
 
@@ -135,6 +138,7 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
   public CacheServerImpl(InternalCache cache, boolean isGatewayReceiver) {
     super(cache);
     this.isGatewayReceiver = isGatewayReceiver;
+    this.securityService = cache.getSecurityService();
   }
 
   // //////////////////// Instance Methods ///////////////////

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index c813a80..c886c36 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -213,6 +213,7 @@ import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.offheap.MemoryAllocator;
 import org.apache.geode.internal.process.ClusterConfigurationNotAvailableException;
 import org.apache.geode.internal.security.SecurityService;
+import org.apache.geode.internal.security.SecurityServiceFactory;
 import org.apache.geode.internal.sequencelog.SequenceLoggerImpl;
 import org.apache.geode.internal.tcp.ConnectionTable;
 import org.apache.geode.internal.util.concurrent.FutureResult;
@@ -583,7 +584,7 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
 
   private final Map<Class<? extends CacheService>, CacheService> services = new HashMap<>();
 
-  private final SecurityService securityService = SecurityService.getSecurityService();
+  private final SecurityService securityService;
 
   static {
     // this works around jdk bug 6427854, reported in ticket #44434
@@ -753,6 +754,7 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
       synchronized (GemFireCacheImpl.class) {
         GemFireCacheImpl instance = checkExistingCache(existingOk, cacheConfig);
         if (instance == null) {
+          // TODO:KIRK: create SecurityService
           instance = new GemFireCacheImpl(isClient, pf, system, cacheConfig, asyncEventListeners,
               typeRegistry);
           instance.initialize();
@@ -809,6 +811,9 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
       JNDIInvoker.mapTransactions(system);
       this.system = (InternalDistributedSystem) system;
       this.dm = this.system.getDistributionManager();
+
+      this.securityService = SecurityServiceFactory.create(this.cacheConfig, this.system.getConfig());
+
       if (!this.isClient && PoolManager.getAll().isEmpty()) {
         // We only support management on members of a distributed system
         // Should do this: if (!getSystem().isLoner()) {
@@ -928,6 +933,11 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
   }
 
   @Override
+  public SecurityService getSecurityService() {
+    return this.securityService;
+  }
+
+  @Override
   public boolean isRESTServiceRunning() {
     return this.isRESTServiceRunning;
   }
@@ -3785,7 +3795,7 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
     }
     this.stopper.checkCancelInProgress(null);
 
-    CacheServerImpl cacheServer = new CacheServerImpl(this, isGatewayReceiver);
+    CacheServerImpl cacheServer = new CacheServerImpl(this, isGatewayReceiver); // TODO:KIRK
     this.allCacheServers.add(cacheServer);
 
     sendAddCacheServerProfileMessage();

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java b/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
index 5533ed1..25684e2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
@@ -60,6 +60,7 @@ import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
 import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
 import org.apache.geode.internal.logging.InternalLogWriter;
 import org.apache.geode.internal.offheap.MemoryAllocator;
+import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.management.internal.JmxManagerAdvisor;
 import org.apache.geode.management.internal.RestAgent;
 import org.apache.geode.pdx.PdxInstanceFactory;
@@ -307,4 +308,6 @@ public interface InternalCache extends Cache, Extensible<Cache>, CacheTime {
   PdxInstanceFactory createPdxInstanceFactory(String className, boolean expectDomainClass);
 
   void waitForRegisterInterestsInProgress();
+
+  SecurityService getSecurityService();
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/Command.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/Command.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/Command.java
index d7f7c7b..136a11f 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/Command.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/Command.java
@@ -16,9 +16,10 @@ package org.apache.geode.internal.cache.tier;
 
 import org.apache.geode.internal.cache.tier.sockets.Message;
 import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
+import org.apache.geode.internal.security.SecurityService;
 
 public interface Command {
-  void execute(Message message, ServerConnection serverConnection);
+  void execute(Message clientMessage, ServerConnection serverConnection, SecurityService securityService);
 
   int RESPONDED = 1;
 

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/CommandContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/CommandContext.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/CommandContext.java
new file mode 100644
index 0000000..cd5d29c
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/CommandContext.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geode.internal.cache.tier;
+
+import org.apache.geode.internal.cache.tier.sockets.Message;
+import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
+import org.apache.geode.internal.security.SecurityService;
+
+public interface CommandContext {
+
+  Message getMessage();
+
+  ServerConnection getServerConnection();
+
+  SecurityService getSecurityService();
+
+  long getStatTimeStart();
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
index 9658f98..d46e88f 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
@@ -272,7 +272,7 @@ public class AcceptorImpl extends Acceptor implements Runnable {
   private List<GatewayTransportFilter> gatewayTransportFilters;
   private final SocketCreator socketCreator;
 
-  private SecurityService securityService = IntegratedSecurityService.getSecurityService();
+  private final SecurityService securityService;
 
   /**
    * Initializes this acceptor thread to listen for connections on the given port.
@@ -297,6 +297,7 @@ public class AcceptorImpl extends Acceptor implements Runnable {
       int maxConnections, int maxThreads, int maximumMessageCount, int messageTimeToLive,
       ConnectionListener listener, List overflowAttributesList, boolean isGatewayReceiver,
       List<GatewayTransportFilter> transportFilter, boolean tcpNoDelay) throws IOException {
+    this.securityService = internalCache.getSecurityService();
     this.bindHostName = calcBindHostName(internalCache, bindHostName);
     this.connectionListener = listener == null ? new ConnectionListenerAdapter() : listener;
     this.notifyBySubscription = notifyBySubscription;
@@ -1470,7 +1471,7 @@ public class AcceptorImpl extends Acceptor implements Runnable {
       }
       ServerConnection serverConn = new ServerConnection(s, this.cache, this.crHelper, this.stats,
           AcceptorImpl.handShakeTimeout, this.socketBufferSize, communicationModeStr,
-          communicationMode, this);
+          communicationMode, this, this.securityService);
       synchronized (this.allSCsLock) {
         this.allSCs.add(serverConn);
         ServerConnection snap[] = this.allSCList; // avoid volatile read

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommand.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommand.java
index 1fb8c8c..446da77 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommand.java
@@ -115,8 +115,6 @@ public abstract class BaseCommand implements Command {
 
   private static final Semaphore INCOMING_MSG_LIMITER;
 
-  protected SecurityService securityService = IntegratedSecurityService.getSecurityService();
-
   static {
     Semaphore semaphore;
     if (MAX_INCOMING_DATA > 0) {
@@ -140,7 +138,7 @@ public abstract class BaseCommand implements Command {
   }
 
   @Override
-  public void execute(Message clientMessage, ServerConnection serverConnection) {
+  public void execute(Message clientMessage, ServerConnection serverConnection, SecurityService securityService) {
     // Read the request and update the statistics
     long start = DistributionStats.getStatTime();
     if (EntryLogger.isEnabled() && serverConnection != null) {
@@ -156,13 +154,13 @@ public abstract class BaseCommand implements Command {
         TXStateProxy tx = null;
         try {
           tx = txMgr.masqueradeAs(clientMessage, member, false);
-          cmdExecute(clientMessage, serverConnection, start);
+          cmdExecute(clientMessage, serverConnection, securityService, start);
           tx.updateProxyServer(txMgr.getMemberId());
         } finally {
           txMgr.unmasquerade(tx);
         }
       } else {
-        cmdExecute(clientMessage, serverConnection, start);
+        cmdExecute(clientMessage, serverConnection, securityService, start);
       }
 
     } catch (TransactionException | CopyException | SerializationException | CacheWriterException
@@ -265,8 +263,7 @@ public abstract class BaseCommand implements Command {
     return tag;
   }
 
-  public abstract void cmdExecute(Message clientMessage, ServerConnection serverConnection,
-      long start) throws IOException, ClassNotFoundException, InterruptedException;
+  public abstract void cmdExecute(final Message clientMessage, final ServerConnection serverConnection, final SecurityService securityService, final long start) throws IOException, ClassNotFoundException, InterruptedException;
 
   protected void writeReply(Message origMsg, ServerConnection serverConnection) throws IOException {
     Message replyMsg = serverConnection.getReplyMessage();

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
index adf702a..b0c66e1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
@@ -42,47 +42,35 @@ import org.apache.geode.internal.cache.tier.MessageType;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 import org.apache.geode.internal.security.AuthorizeRequestPP;
+import org.apache.geode.internal.security.SecurityService;
 
 public abstract class BaseCommandQuery extends BaseCommand {
 
   /**
    * Process the give query and sends the resulset back to the client.
    *
-   * @param msg
-   * @param query
-   * @param queryString
-   * @param regionNames
-   * @param start
-   * @param cqQuery
-   * @param queryContext
-   * @param servConn
    * @return true if successful execution false in case of failure.
-   * @throws IOException
    */
   protected boolean processQuery(Message msg, Query query, String queryString, Set regionNames,
-      long start, ServerCQ cqQuery, QueryOperationContext queryContext, ServerConnection servConn,
-      boolean sendResults) throws IOException, InterruptedException {
+                                 long start, ServerCQ cqQuery, QueryOperationContext queryContext,
+                                 ServerConnection servConn,
+                                 boolean sendResults,
+                                 final SecurityService securityService) throws IOException, InterruptedException {
     return processQueryUsingParams(msg, query, queryString, regionNames, start, cqQuery,
-        queryContext, servConn, sendResults, null);
+        queryContext, servConn, sendResults, null, securityService);
   }
 
   /**
    * Process the give query and sends the resulset back to the client.
    *
-   * @param msg
-   * @param query
-   * @param queryString
-   * @param regionNames
-   * @param start
-   * @param cqQuery
-   * @param queryContext
-   * @param servConn
    * @return true if successful execution false in case of failure.
-   * @throws IOException
    */
   protected boolean processQueryUsingParams(Message msg, Query query, String queryString,
-      Set regionNames, long start, ServerCQ cqQuery, QueryOperationContext queryContext,
-      ServerConnection servConn, boolean sendResults, Object[] params)
+                                            Set regionNames, long start, ServerCQ cqQuery,
+                                            QueryOperationContext queryContext,
+                                            ServerConnection servConn, boolean sendResults,
+                                            Object[] params,
+                                            final SecurityService securityService)
       throws IOException, InterruptedException {
     ChunkedMessage queryResponseMsg = servConn.getQueryResponseMessage();
     CacheServerStats stats = servConn.getCacheServerStats();
@@ -103,7 +91,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
     try {
       // integrated security
       for (Object regionName : regionNames) {
-        this.securityService.authorizeRegionRead(regionName.toString());
+        securityService.authorizeRegionRead(regionName.toString());
       }
 
       // Execute query
@@ -226,7 +214,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
           // send it as a part of ObjectPartList
           if (hasSerializedObjects) {
             sendResultsAsObjectPartList(numberOfChunks, servConn, selectResults.asList(), isStructs,
-                collectionType, queryString, cqQuery, sendCqResultsWithKey, sendResults);
+                collectionType, queryString, cqQuery, sendCqResultsWithKey, sendResults, securityService);
           } else {
             sendResultsAsObjectArray(selectResults, numberOfChunks, servConn, isStructs,
                 collectionType, queryString, cqQuery, sendCqResultsWithKey, sendResults);
@@ -314,7 +302,8 @@ public abstract class BaseCommandQuery extends BaseCommand {
   }
 
   protected void sendCqResponse(int msgType, String msgStr, int txId, Throwable e,
-      ServerConnection servConn) throws IOException {
+                                ServerConnection servConn,
+                                final SecurityService securityService) throws IOException {
     ChunkedMessage cqMsg = servConn.getChunkedResponseMessage();
     if (logger.isDebugEnabled()) {
       logger.debug("CQ Response message :{}", msgStr);
@@ -455,8 +444,10 @@ public abstract class BaseCommandQuery extends BaseCommand {
   }
 
   private void sendResultsAsObjectPartList(int numberOfChunks, ServerConnection servConn, List objs,
-      boolean isStructs, CollectionType collectionType, String queryString, ServerCQ cqQuery,
-      boolean sendCqResultsWithKey, boolean sendResults) throws IOException {
+                                           boolean isStructs, CollectionType collectionType,
+                                           String queryString, ServerCQ cqQuery,
+                                           boolean sendCqResultsWithKey, boolean sendResults,
+                                           final SecurityService securityService) throws IOException {
     int resultIndex = 0;
     Object result = null;
     for (int j = 0; j < numberOfChunks; j++) {
@@ -499,7 +490,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
           result = objs.get(resultIndex);
         }
         if (sendResults) {
-          addToObjectPartList(serializedObjs, result, collectionType, false, servConn, isStructs);
+          addToObjectPartList(serializedObjs, result, collectionType, false, servConn, isStructs, securityService);
         }
         resultIndex++;
       }
@@ -517,14 +508,16 @@ public abstract class BaseCommandQuery extends BaseCommand {
   }
 
   private void addToObjectPartList(ObjectPartList serializedObjs, Object res,
-      CollectionType collectionType, boolean lastChunk, ServerConnection servConn,
-      boolean isStructs) throws IOException {
+                                   CollectionType collectionType, boolean lastChunk,
+                                   ServerConnection servConn,
+                                   boolean isStructs,
+                                   final SecurityService securityService) throws IOException {
     if (isStructs && (res instanceof Struct)) {
       Object[] values = ((Struct) res).getFieldValues();
       // create another ObjectPartList for the struct
       ObjectPartList serializedValueObjs = new ObjectPartList(values.length, false);
       for (Object value : values) {
-        addObjectToPartList(serializedValueObjs, null, value);
+        addObjectToPartList(serializedValueObjs, null, value, securityService);
       }
       serializedObjs.addPart(null, serializedValueObjs, ObjectPartList.OBJECT, null);
     } else if (res instanceof Object[]) {// for CQ key-value pairs
@@ -534,15 +527,16 @@ public abstract class BaseCommandQuery extends BaseCommand {
       for (int i = 0; i < values.length; i += 2) {
         Object key = values[i];
         Object value = values[i + 1];
-        addObjectToPartList(serializedValueObjs, key, value);
+        addObjectToPartList(serializedValueObjs, key, value, securityService);
       }
       serializedObjs.addPart(null, serializedValueObjs, ObjectPartList.OBJECT, null);
     } else { // for deserialized objects
-      addObjectToPartList(serializedObjs, null, res);
+      addObjectToPartList(serializedObjs, null, res, securityService);
     }
   }
 
-  private void addObjectToPartList(ObjectPartList objPartList, Object key, Object value) {
+  private void addObjectToPartList(ObjectPartList objPartList, Object key, Object value,
+                                   final SecurityService securityService) {
     Object object = value;
     boolean isObject = true;
     if (value instanceof CachedDeserializable) {
@@ -551,7 +545,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
       isObject = false;
     }
 
-    object = this.securityService.postProcess(null, key, object, isObject);
+    object = securityService.postProcess(null, key, object, isObject);
     if (key != null) {
       objPartList.addPart(null, key, ObjectPartList.OBJECT, null);
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
index fd5154f..532f116 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
@@ -17,9 +17,7 @@ package org.apache.geode.internal.cache.tier.sockets;
 import static org.apache.geode.distributed.ConfigurationProperties.*;
 
 import java.io.BufferedOutputStream;
-import java.io.DataInput;
 import java.io.DataInputStream;
-import java.io.DataOutput;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Method;
@@ -70,12 +68,7 @@ import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.DistributionManager;
-import org.apache.geode.distributed.internal.HighPriorityDistributionMessage;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.distributed.internal.MessageWithReply;
-import org.apache.geode.distributed.internal.ReplyMessage;
-import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.internal.ClassLoadUtil;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.statistics.DummyStatisticsFactory;
@@ -337,14 +330,14 @@ public class CacheClientNotifier {
       proxy = registerClient(socket, proxyID, proxy, isPrimary, clientConflation, clientVersion,
           acceptorId, notifyBySubscription);
 
-      Properties credentials = HandShake.readCredentials(dis, dos, system);
+      Properties credentials = HandShake.readCredentials(dis, dos, system, this.cache.getSecurityService());
       if (credentials != null && proxy != null) {
         if (securityLogWriter.fineEnabled()) {
           securityLogWriter
               .fine("CacheClientNotifier: verifying credentials for proxyID: " + proxyID);
         }
         Object subject = HandShake.verifyCredentials(authenticator, credentials,
-            system.getSecurityProperties(), this.logWriter, this.securityLogWriter, member);
+            system.getSecurityProperties(), this.logWriter, this.securityLogWriter, member, this.cache.getSecurityService());
         if (subject instanceof Principal) {
           Principal principal = (Principal) subject;
           if (securityLogWriter.fineEnabled()) {
@@ -460,7 +453,7 @@ public class CacheClientNotifier {
               proxyId.getDurableId());
         }
         l_proxy = new CacheClientProxy(this, socket, proxyId, isPrimary, clientConflation,
-            clientVersion, acceptorId, notifyBySubscription);
+            clientVersion, acceptorId, notifyBySubscription, this.cache.getSecurityService());
         successful = this.initializeProxy(l_proxy);
       } else {
         if (proxy.isPrimary()) {
@@ -538,7 +531,7 @@ public class CacheClientNotifier {
       if (toCreateNewProxy) {
         // Create the new proxy for this non-durable client
         l_proxy = new CacheClientProxy(this, socket, proxyId, isPrimary, clientConflation,
-            clientVersion, acceptorId, notifyBySubscription);
+            clientVersion, acceptorId, notifyBySubscription, this.cache.getSecurityService());
         successful = this.initializeProxy(l_proxy);
       }
     }
@@ -963,7 +956,7 @@ public class CacheClientNotifier {
   private void singletonRouteClientMessage(Conflatable conflatable,
       Collection<ClientProxyMembershipID> filterClients) {
 
-    this._cache.getCancelCriterion().checkCancelInProgress(null); // bug #43942 - client notified
+    this.cache.getCancelCriterion().checkCancelInProgress(null); // bug #43942 - client notified
                                                                   // but no p2p distribution
 
     List<CacheClientProxy> deadProxies = null;
@@ -1845,15 +1838,15 @@ public class CacheClientNotifier {
    * @return this <code>CacheClientNotifier</code>'s <code>InternalCache</code>
    */
   protected InternalCache getCache() { // TODO:SYNC: looks wrong
-    if (this._cache != null && this._cache.isClosed()) {
+    if (this.cache != null && this.cache.isClosed()) {
       InternalCache cache = GemFireCacheImpl.getInstance();
       if (cache != null) {
-        this._cache = cache;
+        this.cache = cache;
         this.logWriter = cache.getInternalLogWriter();
         this.securityLogWriter = cache.getSecurityInternalLogWriter();
       }
     }
-    return this._cache;
+    return this.cache;
   }
 
   /**
@@ -2016,7 +2009,7 @@ public class CacheClientNotifier {
       if (!isCompiledQueryCleanupThreadStarted) {
         long period = DefaultQuery.TEST_COMPILED_QUERY_CLEAR_TIME > 0
             ? DefaultQuery.TEST_COMPILED_QUERY_CLEAR_TIME : DefaultQuery.COMPILED_QUERY_CLEAR_TIME;
-        _cache.getCCPTimer().scheduleAtFixedRate(task, period, period);
+        cache.getCCPTimer().scheduleAtFixedRate(task, period, period);
       }
       isCompiledQueryCleanupThreadStarted = true;
     }
@@ -2063,7 +2056,7 @@ public class CacheClientNotifier {
     if (logger.isDebugEnabled()) {
       logger.debug("Scheduling client ping task with period={} ms", CLIENT_PING_TASK_PERIOD);
     }
-    CacheClientNotifier.this._cache.getCCPTimer().scheduleAtFixedRate(this.clientPingTask,
+    CacheClientNotifier.this.cache.getCCPTimer().scheduleAtFixedRate(this.clientPingTask,
         CLIENT_PING_TASK_PERIOD, CLIENT_PING_TASK_PERIOD);
   }
 
@@ -2098,10 +2091,10 @@ public class CacheClientNotifier {
 
   /**
    * The GemFire <code>InternalCache</code>. Note that since this is a singleton class you should
-   * not use a direct reference to _cache in CacheClientNotifier code. Instead, you should always
+   * not use a direct reference to cache in CacheClientNotifier code. Instead, you should always
    * use <code>getCache()</code>
    */
-  private InternalCache _cache;
+  private InternalCache cache;
 
   private InternalLogWriter logWriter;
 
@@ -2216,8 +2209,8 @@ public class CacheClientNotifier {
     // lazily initialize haContainer in case this CCN instance was created by a gateway receiver
     if (overflowAttributesList != null
         && !HARegionQueue.HA_EVICTION_POLICY_NONE.equals(overflowAttributesList.get(0))) {
-      haContainer = new HAContainerRegion(_cache.getRegion(Region.SEPARATOR
-          + CacheServerImpl.clientMessagesRegion(_cache, (String) overflowAttributesList.get(0),
+      haContainer = new HAContainerRegion(cache.getRegion(Region.SEPARATOR
+          + CacheServerImpl.clientMessagesRegion(cache, (String) overflowAttributesList.get(0),
               ((Integer) overflowAttributesList.get(1)).intValue(),
               ((Integer) overflowAttributesList.get(2)).intValue(),
               (String) overflowAttributesList.get(3), (Boolean) overflowAttributesList.get(4))));
@@ -2246,10 +2239,10 @@ public class CacheClientNotifier {
   }
 
   /**
-   * @param _cache the _cache to set
+   * @param _cache the cache to set
    */
   private void setCache(InternalCache _cache) {
-    this._cache = _cache;
+    this.cache = _cache;
   }
 
   private class ExpireBlackListTask extends PoolTask {

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
index 8450db9..79a54a4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
@@ -327,7 +327,7 @@ public class CacheClientProxy implements ClientSession {
   private int numDrainsInProgress = 0;
   private final Object drainsInProgressLock = new Object();
 
-  private SecurityService securityService = SecurityService.getSecurityService();
+  private final SecurityService securityService;
 
   /**
    * Constructor.
@@ -340,10 +340,12 @@ public class CacheClientProxy implements ClientSession {
    */
   protected CacheClientProxy(CacheClientNotifier ccn, Socket socket,
       ClientProxyMembershipID proxyID, boolean isPrimary, byte clientConflation,
-      Version clientVersion, long acceptorId, boolean notifyBySubscription) throws CacheException {
+      Version clientVersion, long acceptorId, boolean notifyBySubscription, SecurityService securityService) throws CacheException {
+
     initializeTransientFields(socket, proxyID, isPrimary, clientConflation, clientVersion);
     this._cacheClientNotifier = ccn;
     this._cache = ccn.getCache();
+    this.securityService = securityService;
     this._maximumMessageCount = ccn.getMaximumMessageCount();
     this._messageTimeToLive = ccn.getMessageTimeToLive();
     this._acceptorId = acceptorId;

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandContextImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandContextImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandContextImpl.java
new file mode 100644
index 0000000..d4cf4ae
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandContextImpl.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geode.internal.cache.tier.sockets;
+
+import org.apache.geode.internal.cache.tier.CommandContext;
+import org.apache.geode.internal.security.SecurityService;
+
+public class CommandContextImpl implements CommandContext {
+
+  private final Message clientMessage;
+  private final ServerConnection serverConnection;
+  private final SecurityService securityService;
+  private final long statTimeStart;
+
+  public CommandContextImpl(Message clientMessage, ServerConnection serverConnection, SecurityService securityService) {
+    this(clientMessage, serverConnection, securityService, 0);
+  }
+
+  public CommandContextImpl(CommandContext commandContext, long statTimeStart) {
+    this(commandContext.getMessage(), commandContext.getServerConnection(), commandContext.getSecurityService(), statTimeStart);
+  }
+
+  public CommandContextImpl(Message clientMessage, ServerConnection serverConnection, SecurityService securityService, long statTimeStart) {
+    this.clientMessage = clientMessage;
+    this.serverConnection = serverConnection;
+    this.securityService = securityService;
+    this.statTimeStart = statTimeStart;
+  }
+
+  @Override
+  public Message getMessage() {
+    return this.clientMessage;
+  }
+
+  @Override
+  public ServerConnection getServerConnection() {
+    return this.serverConnection;
+  }
+
+  @Override
+  public SecurityService getSecurityService() {
+    return this.securityService;
+  }
+
+  @Override
+  public long getStatTimeStart() {
+    return this.statTimeStart;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java
index 388f838..87c490d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java
@@ -48,6 +48,7 @@ import org.apache.geode.internal.cache.tier.ConnectionProxy;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.InternalLogWriter;
 import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.security.DisabledSecurityService;
 import org.apache.geode.internal.security.IntegratedSecurityService;
 import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.pdx.internal.PeerTypeRegistration;
@@ -120,7 +121,7 @@ public class HandShake implements ClientHandShake {
 
   public static final byte REPLY_SERVER_IS_LOCATOR = (byte) 67;
 
-  private static SecurityService securityService = IntegratedSecurityService.getSecurityService();
+  private final SecurityService securityService;
 
   private byte code;
   private int clientReadTimeout = PoolFactory.DEFAULT_READ_TIMEOUT;
@@ -248,19 +249,20 @@ public class HandShake implements ClientHandShake {
   protected HandShake() {
     system = null;
     id = null;
+    this.securityService = new DisabledSecurityService();
   }
 
   /**
    * HandShake Constructor used by server side connection
    */
   public HandShake(Socket sock, int timeout, DistributedSystem sys, Version clientVersion,
-      byte communicationMode) throws IOException, AuthenticationRequiredException {
+      byte communicationMode, SecurityService securityService) throws IOException, AuthenticationRequiredException {
+
     this.clientVersion = clientVersion;
     this.system = sys;
-    // SocketChannel sc = sock.getChannel();
-    /*
-     * if (sc != null) { } else
-     */ {
+    this.securityService = securityService;
+
+    {
       int soTimeout = -1;
       try {
         soTimeout = sock.getSoTimeout();
@@ -298,7 +300,7 @@ public class HandShake implements ClientHandShake {
           // Hitesh
           if (this.clientVersion.compareTo(Version.GFE_65) < 0
               || communicationMode == Acceptor.GATEWAY_TO_GATEWAY) {
-            this.credentials = readCredentials(dis, dos, sys);
+            this.credentials = readCredentials(dis, dos, sys, this.securityService);
           } else {
             this.credentials = this.readCredential(dis, dos, sys);
           }
@@ -335,6 +337,7 @@ public class HandShake implements ClientHandShake {
     this.system = sys;
     setOverrides();
     this.credentials = null;
+    this.securityService = new DisabledSecurityService();
   }
 
   public void updateProxyID(InternalDistributedMember idm) {
@@ -358,6 +361,7 @@ public class HandShake implements ClientHandShake {
     this.overrides = handShake.overrides;
     this.system = handShake.system;
     this.id = handShake.id;
+    this.securityService = handShake.securityService;
     // create new one
     this._decrypt = null;
     this._encrypt = null;
@@ -1085,7 +1089,7 @@ public class HandShake implements ClientHandShake {
     // Initialize the keys when either the host is a client that has
     // non-blank setting for DH symmetric algo, or this is a server
     // that has authenticator defined.
-    if ((dhSKAlgo != null && dhSKAlgo.length() > 0) || securityService.isClientSecurityRequired()) {
+    if ((dhSKAlgo != null && dhSKAlgo.length() > 0) /*|| securityService.isClientSecurityRequired()*/) {
       KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DH");
       DHParameterSpec dhSpec = new DHParameterSpec(dhP, dhG, dhL);
       keyGen.initialize(dhSpec);
@@ -1536,7 +1540,7 @@ public class HandShake implements ClientHandShake {
 
   // This assumes that authentication is the last piece of info in handshake
   public static Properties readCredentials(DataInputStream dis, DataOutputStream dos,
-      DistributedSystem system) throws GemFireSecurityException, IOException {
+      DistributedSystem system, SecurityService securityService) throws GemFireSecurityException, IOException {
 
     boolean requireAuthentication = securityService.isClientSecurityRequired();
     Properties credentials = null;
@@ -1671,7 +1675,7 @@ public class HandShake implements ClientHandShake {
    */
   public static Object verifyCredentials(String authenticatorMethod, Properties credentials,
       Properties securityProperties, InternalLogWriter logWriter,
-      InternalLogWriter securityLogWriter, DistributedMember member)
+      InternalLogWriter securityLogWriter, DistributedMember member, SecurityService securityService)
       throws AuthenticationRequiredException, AuthenticationFailedException {
 
     if (!AcceptorImpl.isAuthenticationRequired()) {
@@ -1704,7 +1708,7 @@ public class HandShake implements ClientHandShake {
     String methodName = this.system.getProperties().getProperty(SECURITY_CLIENT_AUTHENTICATOR);
     return verifyCredentials(methodName, this.credentials, this.system.getSecurityProperties(),
         (InternalLogWriter) this.system.getLogWriter(),
-        (InternalLogWriter) this.system.getSecurityLogWriter(), this.id.getDistributedMember());
+        (InternalLogWriter) this.system.getSecurityLogWriter(), this.id.getDistributedMember(), this.securityService);
   }
 
   public void sendCredentialsForWan(OutputStream out, InputStream in) {
@@ -1730,10 +1734,10 @@ public class HandShake implements ClientHandShake {
       return;
     }
     String authenticator = this.system.getProperties().getProperty(SECURITY_CLIENT_AUTHENTICATOR);
-    Properties peerWanProps = readCredentials(dis, dos, this.system);
+    Properties peerWanProps = readCredentials(dis, dos, this.system, this.securityService);
     verifyCredentials(authenticator, peerWanProps, this.system.getSecurityProperties(),
         (InternalLogWriter) this.system.getLogWriter(),
-        (InternalLogWriter) this.system.getSecurityLogWriter(), member);
+        (InternalLogWriter) this.system.getSecurityLogWriter(), member, this.securityService);
   }
 
   private static int getKeySize(String skAlgo) {

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java
index 485ccae..0275059 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java
@@ -39,7 +39,6 @@ import org.apache.shiro.util.ThreadState;
 import org.apache.geode.CancelException;
 import org.apache.geode.DataSerializer;
 import org.apache.geode.SystemFailure;
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.client.internal.AbstractOp;
 import org.apache.geode.cache.client.internal.Connection;
 import org.apache.geode.distributed.DistributedSystem;
@@ -62,7 +61,6 @@ import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 import org.apache.geode.internal.security.AuthorizeRequest;
 import org.apache.geode.internal.security.AuthorizeRequestPP;
-import org.apache.geode.internal.security.IntegratedSecurityService;
 import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.internal.util.Breadcrumbs;
 import org.apache.geode.security.AuthenticationFailedException;
@@ -88,7 +86,7 @@ public class ServerConnection implements Runnable {
 
   private Map commands;
 
-  private SecurityService securityService = IntegratedSecurityService.getSecurityService();
+  private final SecurityService securityService;
 
   final protected CacheServerStats stats;
 
@@ -250,25 +248,26 @@ public class ServerConnection implements Runnable {
    * Creates a new <code>ServerConnection</code> that processes messages received from an edge
    * client over a given <code>Socket</code>.
    */
-  public ServerConnection(Socket s, Cache c, CachedRegionHelper helper, CacheServerStats stats,
-      int hsTimeout, int socketBufferSize, String communicationModeStr, byte communicationMode,
-      Acceptor acceptor) {
-    StringBuffer buffer = new StringBuffer(100);
+  public ServerConnection(Socket socket, InternalCache internalCache, CachedRegionHelper helper, CacheServerStats stats,
+                          int hsTimeout, int socketBufferSize, String communicationModeStr, byte communicationMode,
+                          Acceptor acceptor, SecurityService securityService) {
+
+    StringBuilder buffer = new StringBuilder(100);
     if (((AcceptorImpl) acceptor).isGatewayReceiver()) {
       buffer.append("GatewayReceiver connection from [");
     } else {
       buffer.append("Server connection from [");
     }
     buffer.append(communicationModeStr).append(" host address=")
-        .append(s.getInetAddress().getHostAddress()).append("; ").append(communicationModeStr)
-        .append(" port=").append(s.getPort()).append("]");
+        .append(socket.getInetAddress().getHostAddress()).append("; ").append(communicationModeStr)
+        .append(" port=").append(socket.getPort()).append("]");
     this.name = buffer.toString();
 
     this.stats = stats;
     this.acceptor = (AcceptorImpl) acceptor;
     this.crHelper = helper;
-    this.logWriter = (InternalLogWriter) c.getLoggerI18n();
-    this.securityLogWriter = (InternalLogWriter) c.getSecurityLoggerI18n();
+    this.logWriter = (InternalLogWriter) internalCache.getLoggerI18n();
+    this.securityLogWriter = (InternalLogWriter) internalCache.getSecurityLoggerI18n();
     this.communicationModeStr = communicationModeStr;
     this.communicationMode = communicationMode;
     this.principal = null;
@@ -276,20 +275,18 @@ public class ServerConnection implements Runnable {
     this.postAuthzRequest = null;
     this.randomConnectionIdGen = new Random(this.hashCode());
 
+    this.securityService = securityService;
+
     final boolean isDebugEnabled = logger.isDebugEnabled();
     try {
-      // requestMsg.setUseDataStream(useDataStream);
-      // replyMsg.setUseDataStream(useDataStream);
-      // responseMsg.setUseDataStream(useDataStream);
-      // errorMsg.setUseDataStream(useDataStream);
 
-      initStreams(s, socketBufferSize, stats);
+      initStreams(socket, socketBufferSize, stats);
 
       if (isDebugEnabled) {
         logger.debug(
             "{}: Accepted client connection from {}[client host name={}; client host address={}; client port={}]",
-            getName(), s.getInetAddress().getCanonicalHostName(),
-            s.getInetAddress().getHostAddress(), s.getPort());
+            getName(), communicationModeStr, socket.getInetAddress().getCanonicalHostName(),
+            socket.getInetAddress().getHostAddress(), socket.getPort());
       }
       this.handShakeTimeout = hsTimeout;
     } catch (Exception e) {
@@ -323,7 +320,7 @@ public class ServerConnection implements Runnable {
     synchronized (this.handShakeMonitor) {
       if (this.handshake == null) {
         // synchronized (getCleanupTable()) {
-        boolean readHandShake = ServerHandShakeProcessor.readHandShake(this);
+        boolean readHandShake = ServerHandShakeProcessor.readHandShake(this, getSecurityService());
         if (readHandShake) {
           if (this.handshake.isOK()) {
             try {
@@ -441,6 +438,10 @@ public class ServerConnection implements Runnable {
     return this.securityLogWriter;
   }
 
+  private SecurityService getSecurityService() {
+    return this.securityService;
+  }
+
   private boolean incedCleanupTableRef = false;
   private boolean incedCleanupProxyIdTableRef = false;
 
@@ -777,7 +778,7 @@ public class ServerConnection implements Runnable {
           }
         }
 
-        command.execute(msg, this);
+        command.execute(msg, this, this.securityService);
       }
     } finally {
       // Keep track of the fact that a message is no longer being
@@ -1031,7 +1032,7 @@ public class ServerConnection implements Runnable {
 
       Object principal = HandShake.verifyCredentials(methodName, credentials,
           system.getSecurityProperties(), (InternalLogWriter) system.getLogWriter(),
-          (InternalLogWriter) system.getSecurityLogWriter(), this.proxyId.getDistributedMember());
+          (InternalLogWriter) system.getSecurityLogWriter(), this.proxyId.getDistributedMember(), this.securityService);
       if (principal instanceof Subject) {
         Subject subject = (Subject) principal;
         uniqueId = this.clientUserAuths.putSubject(subject);

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerHandShakeProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerHandShakeProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerHandShakeProcessor.java
index 6534b68..884c2af 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerHandShakeProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerHandShakeProcessor.java
@@ -29,6 +29,7 @@ import java.net.SocketTimeoutException;
 import java.security.Principal;
 import java.util.Properties;
 
+import org.apache.geode.internal.security.SecurityService;
 import org.apache.logging.log4j.Logger;
 import org.apache.shiro.subject.Subject;
 
@@ -77,7 +78,7 @@ public class ServerHandShakeProcessor {
     currentServerVersion = Version.fromOrdinalOrCurrent(ver);
   }
 
-  public static boolean readHandShake(ServerConnection connection) {
+  public static boolean readHandShake(ServerConnection connection, SecurityService securityService) {
     boolean validHandShake = false;
     Version clientVersion = null;
     try {
@@ -120,7 +121,7 @@ public class ServerHandShakeProcessor {
 
       // Read the appropriate handshake
       if (clientVersion.compareTo(Version.GFE_57) >= 0) {
-        validHandShake = readGFEHandshake(connection, clientVersion);
+        validHandShake = readGFEHandshake(connection, clientVersion, securityService);
       } else {
         connection.refuseHandshake(
             "Unsupported version " + clientVersion + "Server's current version " + Acceptor.VERSION,
@@ -196,7 +197,7 @@ public class ServerHandShakeProcessor {
     hdos.close();
   }
 
-  private static boolean readGFEHandshake(ServerConnection connection, Version clientVersion) {
+  private static boolean readGFEHandshake(ServerConnection connection, Version clientVersion, SecurityService securityService) {
     int handShakeTimeout = connection.getHandShakeTimeout();
     InternalLogWriter securityLogWriter = connection.getSecurityLogWriter();
     try {
@@ -204,7 +205,7 @@ public class ServerHandShakeProcessor {
       DistributedSystem system = connection.getDistributedSystem();
       // hitesh:it will set credentials and principals
       HandShake handshake = new HandShake(socket, handShakeTimeout, system, clientVersion,
-          connection.getCommunicationMode());
+          connection.getCommunicationMode(), securityService);
       connection.setHandshake(handshake);
       ClientProxyMembershipID proxyId = handshake.getMembership();
       connection.setProxyId(proxyId);

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxEnum.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxEnum.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxEnum.java
index 2cb36cd..30db6b8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxEnum.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxEnum.java
@@ -24,6 +24,7 @@ import org.apache.geode.internal.cache.tier.sockets.BaseCommand;
 import org.apache.geode.internal.cache.tier.sockets.Message;
 import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
 import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.pdx.internal.EnumInfo;
 import org.apache.geode.pdx.internal.TypeRegistry;
 
@@ -39,7 +40,7 @@ public class AddPdxEnum extends BaseCommand {
   private AddPdxEnum() {}
 
   @Override
-  public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
+  public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection, final SecurityService securityService, long start)
       throws IOException, ClassNotFoundException {
     serverConnection.setAsTrue(REQUIRES_RESPONSE);
     if (logger.isDebugEnabled()) {

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxType.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxType.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxType.java
index 3feba0d..52432ab 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxType.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxType.java
@@ -24,6 +24,7 @@ import org.apache.geode.internal.cache.tier.sockets.BaseCommand;
 import org.apache.geode.internal.cache.tier.sockets.Message;
 import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
 import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.pdx.internal.PdxType;
 import org.apache.geode.pdx.internal.TypeRegistry;
 
@@ -39,7 +40,7 @@ public class AddPdxType extends BaseCommand {
   private AddPdxType() {}
 
   @Override
-  public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
+  public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection, final SecurityService securityService, long start)
       throws IOException, ClassNotFoundException {
     serverConnection.setAsTrue(REQUIRES_RESPONSE);
     if (logger.isDebugEnabled()) {

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClearRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClearRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClearRegion.java
index ab19954..1b1a222 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClearRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClearRegion.java
@@ -35,6 +35,7 @@ import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 import org.apache.geode.internal.security.AuthorizeRequest;
+import org.apache.geode.internal.security.SecurityService;
 
 public class ClearRegion extends BaseCommand {
 
@@ -47,7 +48,7 @@ public class ClearRegion extends BaseCommand {
   }
 
   @Override
-  public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
+  public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection, final SecurityService securityService, long start)
       throws IOException, InterruptedException {
     Part regionNamePart = null, callbackArgPart = null;
     String regionName = null;
@@ -115,7 +116,7 @@ public class ClearRegion extends BaseCommand {
 
     try {
       // Clear the region
-      this.securityService.authorizeRegionWrite(regionName);
+      securityService.authorizeRegionWrite(regionName);
 
       AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
       if (authzRequest != null) {

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClientReady.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClientReady.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClientReady.java
index cf9c470..440722d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClientReady.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClientReady.java
@@ -20,6 +20,7 @@ package org.apache.geode.internal.cache.tier.sockets.command;
 import org.apache.geode.internal.cache.tier.Command;
 import org.apache.geode.internal.cache.tier.sockets.*;
 import org.apache.geode.distributed.internal.DistributionStats;
+import org.apache.geode.internal.security.SecurityService;
 
 import java.io.IOException;
 
@@ -35,7 +36,7 @@ public class ClientReady extends BaseCommand {
   private ClientReady() {}
 
   @Override
-  public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
+  public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection, final SecurityService securityService, long start)
       throws IOException {
     CacheServerStats stats = serverConnection.getCacheServerStats();
     {

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseConnection.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseConnection.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseConnection.java
index 21f0cad..2a9a9a2 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseConnection.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseConnection.java
@@ -27,6 +27,7 @@ import org.apache.geode.internal.cache.tier.sockets.CacheServerStats;
 import org.apache.geode.internal.cache.tier.sockets.Message;
 import org.apache.geode.internal.cache.tier.sockets.Part;
 import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
+import org.apache.geode.internal.security.SecurityService;
 
 public class CloseConnection extends BaseCommand {
 
@@ -39,7 +40,7 @@ public class CloseConnection extends BaseCommand {
   private CloseConnection() {}
 
   @Override
-  public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
+  public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection, final SecurityService securityService, long start)
       throws IOException {
     CacheServerStats stats = serverConnection.getCacheServerStats();
     long oldStart = start;

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CommitCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CommitCommand.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CommitCommand.java
index 366d77c..49af0f4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CommitCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CommitCommand.java
@@ -17,9 +17,7 @@
  */
 package org.apache.geode.internal.cache.tier.sockets.command;
 
-import org.apache.geode.cache.CommitConflictException;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.i18n.LogWriterI18n;
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.cache.TXCommitMessage;
 import org.apache.geode.internal.cache.TXId;
@@ -30,7 +28,7 @@ import org.apache.geode.internal.cache.tier.MessageType;
 import org.apache.geode.internal.cache.tier.sockets.BaseCommand;
 import org.apache.geode.internal.cache.tier.sockets.Message;
 import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
-import org.apache.geode.internal.i18n.LocalizedStrings;
+import org.apache.geode.internal.security.SecurityService;
 
 import java.io.IOException;
 
@@ -50,7 +48,7 @@ public class CommitCommand extends BaseCommand {
   private CommitCommand() {}
 
   @Override
-  public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
+  public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection, final SecurityService securityService, long start)
       throws IOException {
     serverConnection.setAsTrue(REQUIRES_RESPONSE);
     TXManagerImpl txMgr = (TXManagerImpl) serverConnection.getCache().getCacheTransactionManager();

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey.java
index 9cb2528..cab74e3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey.java
@@ -17,9 +17,7 @@ package org.apache.geode.internal.cache.tier.sockets.command;
 import java.io.IOException;
 
 import org.apache.geode.distributed.internal.DistributionStats;
-import org.apache.geode.i18n.LogWriterI18n;
 import org.apache.geode.internal.cache.LocalRegion;
-import org.apache.geode.internal.cache.tier.CachedRegionHelper;
 import org.apache.geode.internal.cache.tier.Command;
 import org.apache.geode.internal.cache.tier.MessageType;
 import org.apache.geode.internal.cache.tier.sockets.BaseCommand;
@@ -30,6 +28,7 @@ import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 import org.apache.geode.internal.security.AuthorizeRequest;
+import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.security.NotAuthorizedException;
 
 public class ContainsKey extends BaseCommand {
@@ -51,7 +50,7 @@ public class ContainsKey extends BaseCommand {
   }
 
   @Override
-  public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
+  public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection, final SecurityService securityService, long start)
       throws IOException {
     Part regionNamePart = null;
     Part keyPart = null;
@@ -117,7 +116,7 @@ public class ContainsKey extends BaseCommand {
     }
 
     try {
-      this.securityService.authorizeRegionRead(regionName, key.toString());
+      securityService.authorizeRegionRead(regionName, key.toString());
     } catch (NotAuthorizedException ex) {
       writeException(clientMessage, ex, false, serverConnection);
       serverConnection.setAsTrue(RESPONDED);

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey66.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey66.java
index b2ce055..c56890e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey66.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey66.java
@@ -12,9 +12,6 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-/**
- *
- */
 package org.apache.geode.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -33,6 +30,7 @@ import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 import org.apache.geode.internal.security.AuthorizeRequest;
+import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.security.NotAuthorizedException;
 
 public class ContainsKey66 extends BaseCommand {
@@ -55,7 +53,7 @@ public class ContainsKey66 extends BaseCommand {
   }
 
   @Override
-  public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
+  public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection, final SecurityService securityService, long start)
       throws IOException {
     Part regionNamePart = null, keyPart = null;
     String regionName = null;
@@ -120,7 +118,7 @@ public class ContainsKey66 extends BaseCommand {
     }
 
     try {
-      this.securityService.authorizeRegionRead(regionName, key.toString());
+      securityService.authorizeRegionRead(regionName, key.toString());
     } catch (NotAuthorizedException ex) {
       writeException(clientMessage, ex, false, serverConnection);
       serverConnection.setAsTrue(RESPONDED);

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CreateRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CreateRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CreateRegion.java
index 0dec596..13ad9de 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CreateRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CreateRegion.java
@@ -12,9 +12,6 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-/**
- *
- */
 package org.apache.geode.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -30,6 +27,7 @@ import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 import org.apache.geode.internal.security.AuthorizeRequest;
+import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.security.NotAuthorizedException;
 
 public class CreateRegion extends BaseCommand {
@@ -41,7 +39,7 @@ public class CreateRegion extends BaseCommand {
   }
 
   @Override
-  public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
+  public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection, final SecurityService securityService, long start)
       throws IOException {
     Part regionNamePart = null;
     String regionName = null;
@@ -100,7 +98,7 @@ public class CreateRegion extends BaseCommand {
     }
 
     try {
-      this.securityService.authorizeDataManage();
+      securityService.authorizeDataManage();
     } catch (NotAuthorizedException ex) {
       writeException(clientMessage, ex, false, serverConnection);
       serverConnection.setAsTrue(RESPONDED);

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Default.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Default.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Default.java
index 3daaec5..8ea8634 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Default.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Default.java
@@ -22,6 +22,7 @@ import org.apache.geode.internal.cache.tier.MessageType;
 import org.apache.geode.internal.cache.tier.sockets.*;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
+import org.apache.geode.internal.security.SecurityService;
 
 import java.io.IOException;
 
@@ -37,7 +38,7 @@ public class Default extends BaseCommand {
   private Default() {}
 
   @Override
-  public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
+  public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection, final SecurityService securityService, long start)
       throws IOException {
     // requiresResponse = true; NOT NEEDED... ALWAYS SEND ERROR RESPONSE
 

http://git-wip-us.apache.org/repos/asf/geode/blob/13b94704/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy.java
index 83ab394..1d3fa25 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy.java
@@ -37,6 +37,7 @@ import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 import org.apache.geode.internal.security.AuthorizeRequest;
+import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.security.GemFireSecurityException;
 
 public class Destroy extends BaseCommand {
@@ -48,7 +49,7 @@ public class Destroy extends BaseCommand {
   }
 
   @Override
-  public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long startparam)
+  public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection, final SecurityService securityService, long startparam)
       throws IOException, InterruptedException {
     long start = startparam;
 
@@ -135,7 +136,7 @@ public class Destroy extends BaseCommand {
 
     try {
       // for integrated security
-      this.securityService.authorizeRegionWrite(regionName, key.toString());
+      securityService.authorizeRegionWrite(regionName, key.toString());
 
       AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
       if (authzRequest != null) {


Mime
View raw message