Return-Path: X-Original-To: apmail-geode-commits-archive@minotaur.apache.org Delivered-To: apmail-geode-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E44561840E for ; Wed, 30 Dec 2015 00:28:23 +0000 (UTC) Received: (qmail 65135 invoked by uid 500); 30 Dec 2015 00:28:23 -0000 Delivered-To: apmail-geode-commits-archive@geode.apache.org Received: (qmail 65104 invoked by uid 500); 30 Dec 2015 00:28:23 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 65095 invoked by uid 99); 30 Dec 2015 00:28:23 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Dec 2015 00:28:23 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 292561A017B for ; Wed, 30 Dec 2015 00:28:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.227 X-Spam-Level: * X-Spam-Status: No, score=1.227 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.554, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id v85XZiOtgx72 for ; Wed, 30 Dec 2015 00:28:14 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id 1D30225897 for ; Wed, 30 Dec 2015 00:28:02 +0000 (UTC) Received: (qmail 63283 invoked by uid 99); 30 Dec 2015 00:28:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Dec 2015 00:28:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 833C5E0A83; Wed, 30 Dec 2015 00:28:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jensdeppe@apache.org To: commits@geode.incubator.apache.org Date: Wed, 30 Dec 2015 00:28:11 -0000 Message-Id: <251bbd56868844d580babfa3ed9ce8a5@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [11/33] incubator-geode git commit: GEM-164: move the security tests in gemfire-test module inside the com.gemstone.gemfire.security packages to the open side. GEM-164: move the security tests in gemfire-test module inside the com.gemstone.gemfire.security packages to the open side. GEM-164: remove the pivotal license header GEM-164: add ASF license headers and have RAT ignore all subprojects' IDE files when checking license GEM-164: remove the duplicate license Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/a622d6ec Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/a622d6ec Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/a622d6ec Branch: refs/heads/feature/GEODE-14 Commit: a622d6ec7f8228443bb99249e08766bd74337c10 Parents: 51ce64d Author: Jinmei Liao Authored: Thu Dec 10 15:14:19 2015 -0800 Committer: Jens Deppe Committed: Mon Dec 21 08:51:59 2015 -0800 ---------------------------------------------------------------------- .../security/ClientAuthenticationDUnitTest.java | 969 +++++++++ .../ClientAuthenticationPart2DUnitTest.java | 88 + .../security/ClientAuthorizationDUnitTest.java | 798 ++++++++ .../security/ClientAuthorizationTestBase.java | 1384 +++++++++++++ .../security/ClientMultiUserAuthzDUnitTest.java | 537 +++++ .../DeltaClientAuthorizationDUnitTest.java | 336 ++++ .../DeltaClientPostAuthorizationDUnitTest.java | 541 +++++ .../security/P2PAuthenticationDUnitTest.java | 622 ++++++ .../gemfire/security/SecurityTestUtil.java | 1871 ++++++++++++++++++ .../security/AuthzCredentialGenerator.java | 465 +++++ .../templates/security/CredentialGenerator.java | 343 ++++ .../security/DummyAuthzCredentialGenerator.java | 142 ++ .../security/DummyCredentialGenerator.java | 90 + .../security/LdapUserCredentialGenerator.java | 158 ++ .../security/PKCSCredentialGenerator.java | 110 + .../security/SSLCredentialGenerator.java | 116 ++ .../UserPasswordWithExtraPropsAuthInit.java | 76 + .../security/XmlAuthzCredentialGenerator.java | 262 +++ .../src/test/resources/lib/authz-dummy.xml | 126 ++ .../src/test/resources/lib/authz-ldap.xml | 85 + .../resources/lib/authz-multiUser-dummy.xml | 106 + .../test/resources/lib/authz-multiUser-ldap.xml | 83 + .../test/resources/lib/keys/gemfire1.keystore | Bin 0 -> 1536 bytes .../test/resources/lib/keys/gemfire10.keystore | Bin 0 -> 1546 bytes .../test/resources/lib/keys/gemfire11.keystore | Bin 0 -> 1546 bytes .../test/resources/lib/keys/gemfire2.keystore | Bin 0 -> 1536 bytes .../test/resources/lib/keys/gemfire3.keystore | Bin 0 -> 1536 bytes .../test/resources/lib/keys/gemfire4.keystore | Bin 0 -> 1536 bytes .../test/resources/lib/keys/gemfire5.keystore | Bin 0 -> 1536 bytes .../test/resources/lib/keys/gemfire6.keystore | Bin 0 -> 1536 bytes .../test/resources/lib/keys/gemfire7.keystore | Bin 0 -> 1536 bytes .../test/resources/lib/keys/gemfire8.keystore | Bin 0 -> 1536 bytes .../test/resources/lib/keys/gemfire9.keystore | Bin 0 -> 1536 bytes .../resources/lib/keys/ibm/gemfire1.keystore | Bin 0 -> 1426 bytes .../resources/lib/keys/ibm/gemfire10.keystore | Bin 0 -> 1434 bytes .../resources/lib/keys/ibm/gemfire11.keystore | Bin 0 -> 1434 bytes .../resources/lib/keys/ibm/gemfire2.keystore | Bin 0 -> 1434 bytes .../resources/lib/keys/ibm/gemfire3.keystore | Bin 0 -> 1426 bytes .../resources/lib/keys/ibm/gemfire4.keystore | Bin 0 -> 1434 bytes .../resources/lib/keys/ibm/gemfire5.keystore | Bin 0 -> 1434 bytes .../resources/lib/keys/ibm/gemfire6.keystore | Bin 0 -> 1434 bytes .../resources/lib/keys/ibm/gemfire7.keystore | Bin 0 -> 1426 bytes .../resources/lib/keys/ibm/gemfire8.keystore | Bin 0 -> 1434 bytes .../resources/lib/keys/ibm/gemfire9.keystore | Bin 0 -> 1426 bytes .../test/resources/lib/keys/ibm/publickeyfile | Bin 0 -> 4535 bytes .../src/test/resources/lib/keys/publickeyfile | Bin 0 -> 4535 bytes .../src/test/resources/ssl/untrusted.keystore | Bin 0 -> 1181 bytes gradle/rat.gradle | 2 +- 48 files changed, 9309 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a622d6ec/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationDUnitTest.java new file mode 100644 index 0000000..2fdbc05 --- /dev/null +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationDUnitTest.java @@ -0,0 +1,969 @@ +package com.gemstone.gemfire.security; + +/* + * 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. + */ + + +import java.io.IOException; +import java.util.Properties; + +import javax.net.ssl.SSLException; +import javax.net.ssl.SSLHandshakeException; + +import templates.security.CredentialGenerator; +import templates.security.CredentialGenerator.ClassCode; + +import com.gemstone.gemfire.cache.Region; +import com.gemstone.gemfire.distributed.internal.DistributionConfig; +import com.gemstone.gemfire.internal.AvailablePort; + +import dunit.DistributedTestCase; +import dunit.Host; +import dunit.VM; +import templates.security.DummyCredentialGenerator; + +/** + * Test for authentication from client to server. This tests for both valid and + * invalid credentials/modules. It also checks for authentication + * success/failure in case of failover and for the notification channel. + * + * @author sumedh + * @since 5.5 + */ +public class ClientAuthenticationDUnitTest extends DistributedTestCase { + + /** constructor */ + public ClientAuthenticationDUnitTest(String name) { + super(name); + } + + private VM server1 = null; + + private VM server2 = null; + + private VM client1 = null; + + private VM client2 = null; + + private static final String[] serverExpectedExceptions = { + AuthenticationRequiredException.class.getName(), + AuthenticationFailedException.class.getName(), + GemFireSecurityException.class.getName(), + ClassNotFoundException.class.getName(), IOException.class.getName(), + SSLException.class.getName(), SSLHandshakeException.class.getName() }; + + private static final String[] clientExpectedExceptions = { + AuthenticationRequiredException.class.getName(), + AuthenticationFailedException.class.getName(), + SSLHandshakeException.class.getName() }; + + @Override + public void setUp() throws Exception { + + super.setUp(); + final Host host = Host.getHost(0); + server1 = host.getVM(0); + server2 = host.getVM(1); + client1 = host.getVM(2); + client2 = host.getVM(3); + + addExpectedException("Connection refused: connect"); + + server1.invoke(SecurityTestUtil.class, "registerExpectedExceptions", + new Object[] { serverExpectedExceptions }); + server2.invoke(SecurityTestUtil.class, "registerExpectedExceptions", + new Object[] { serverExpectedExceptions }); + client1.invoke(SecurityTestUtil.class, "registerExpectedExceptions", + new Object[] { clientExpectedExceptions }); + client2.invoke(SecurityTestUtil.class, "registerExpectedExceptions", + new Object[] { clientExpectedExceptions }); + } + + // Region: Utility and static functions invoked by the tests + + public static Integer createCacheServer(Object dsPort, Object locatorString, + Object authenticator, Object extraProps, Object javaProps) { + + Properties authProps; + if (extraProps == null) { + authProps = new Properties(); + } + else { + authProps = (Properties)extraProps; + } + if (authenticator != null) { + authProps.setProperty( + DistributionConfig.SECURITY_CLIENT_AUTHENTICATOR_NAME, authenticator + .toString()); + } + return SecurityTestUtil.createCacheServer(authProps, javaProps, + (Integer)dsPort, (String)locatorString, null, new Integer( + SecurityTestUtil.NO_EXCEPTION)); + } + + public static void createCacheServer(Object dsPort, Object locatorString, + Integer serverPort, Object authenticator, Object extraProps, + Object javaProps) { + + Properties authProps; + if (extraProps == null) { + authProps = new Properties(); + } + else { + authProps = (Properties)extraProps; + } + if (authenticator != null) { + authProps.setProperty( + DistributionConfig.SECURITY_CLIENT_AUTHENTICATOR_NAME, authenticator + .toString()); + } + SecurityTestUtil.createCacheServer(authProps, javaProps, (Integer)dsPort, + (String)locatorString, serverPort, new Integer( + SecurityTestUtil.NO_EXCEPTION)); + } + + private static void createCacheClient(Object authInit, Properties authProps, + Properties javaProps, Integer[] ports, Object numConnections, + Boolean multiUserMode, Boolean subscriptionEnabled, Integer expectedResult) { + + String authInitStr = (authInit == null ? null : authInit.toString()); + SecurityTestUtil.createCacheClient(authInitStr, authProps, javaProps, + ports, (Integer)numConnections, Boolean.FALSE, + multiUserMode.toString(), subscriptionEnabled, expectedResult); + } + + public static void createCacheClient(Object authInit, Object authProps, + Object javaProps, Integer[] ports, Object numConnections, + Boolean multiUserMode, Integer expectedResult) { + + createCacheClient(authInit, (Properties)authProps, (Properties)javaProps, + ports, numConnections, multiUserMode, Boolean.TRUE, expectedResult); + } + + public static void createCacheClient(Object authInit, Object authProps, + Object javaProps, Integer port1, Object numConnections, + Integer expectedResult) { + + createCacheClient(authInit, (Properties)authProps, (Properties)javaProps, + new Integer[] { port1 }, numConnections, Boolean.FALSE, Boolean.TRUE, + expectedResult); + } + + public static void createCacheClient(Object authInit, Object authProps, + Object javaProps, Integer port1, Integer port2, Object numConnections, + Integer expectedResult) { + createCacheClient(authInit, authProps, javaProps, port1, port2, + numConnections, Boolean.FALSE, expectedResult); + } + + public static void createCacheClient(Object authInit, Object authProps, + Object javaProps, Integer port1, Integer port2, Object numConnections, + Boolean multiUserMode, Integer expectedResult) { + + createCacheClient(authInit, authProps, javaProps, + port1, port2, numConnections, multiUserMode, Boolean.TRUE, + expectedResult); + } + + public static void createCacheClient(Object authInit, Object authProps, + Object javaProps, Integer port1, Integer port2, Object numConnections, + Boolean multiUserMode, Boolean subscriptionEnabled, + Integer expectedResult) { + + createCacheClient(authInit, (Properties)authProps, (Properties)javaProps, + new Integer[] { port1, port2 }, numConnections, multiUserMode, + subscriptionEnabled, expectedResult); + } + + public static void registerAllInterest() { + + Region region = SecurityTestUtil.getCache().getRegion( + SecurityTestUtil.regionName); + assertNotNull(region); + region.registerInterestRegex(".*"); + } + + // End Region: Utility and static functions invoked by the tests + + // Region: Tests + + public void testValidCredentials() { + itestValidCredentials(Boolean.FALSE); + } + + public void itestValidCredentials(Boolean multiUser) { + CredentialGenerator gen = new DummyCredentialGenerator(); + Properties extraProps = gen.getSystemProperties(); + Properties javaProps = gen.getJavaProperties(); + String authenticator = gen.getAuthenticator(); + String authInit = gen.getAuthInit(); + + getLogWriter().info( + "testValidCredentials: Using scheme: " + gen.classCode()); + getLogWriter().info( + "testValidCredentials: Using authenticator: " + authenticator); + getLogWriter().info("testValidCredentials: Using authinit: " + authInit); + + // Start the servers + Integer locPort1 = SecurityTestUtil.getLocatorPort(); + Integer locPort2 = SecurityTestUtil.getLocatorPort(); + String locString = SecurityTestUtil.getLocatorString(); + Integer port1 = (Integer)server1.invoke( + ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort1, locString, authenticator, extraProps, + javaProps }); + Integer port2 = (Integer)server2.invoke( + ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort2, locString, authenticator, extraProps, + javaProps }); + + // Start the clients with valid credentials + Properties credentials1 = gen.getValidCredentials(1); + Properties javaProps1 = gen.getJavaProperties(); + getLogWriter().info( + "testValidCredentials: For first client credentials: " + credentials1 + + " : " + javaProps1); + Properties credentials2 = gen.getValidCredentials(2); + Properties javaProps2 = gen.getJavaProperties(); + getLogWriter().info( + "testValidCredentials: For second client credentials: " + + credentials2 + " : " + javaProps2); + client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials1, javaProps1, port1, port2, + null, multiUser, new Integer(SecurityTestUtil.NO_EXCEPTION) }); + client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials2, javaProps2, port1, port2, + null, multiUser, new Integer(SecurityTestUtil.NO_EXCEPTION) }); + + // Perform some put operations from client1 + client1.invoke(SecurityTestUtil.class, "doPuts", + new Object[] { new Integer(2) }); + + // Verify that the puts succeeded + client2.invoke(SecurityTestUtil.class, "doGets", + new Object[] { new Integer(2) }); + + if (multiUser) { + client1.invoke(SecurityTestUtil.class, "doProxyCacheClose"); + client2.invoke(SecurityTestUtil.class, "doProxyCacheClose"); + client1.invoke(SecurityTestUtil.class, "doSimplePut", + new Object[] {"CacheClosedException"}); + client2.invoke(SecurityTestUtil.class, "doSimpleGet", + new Object[] {"CacheClosedException"}); + } + } + + public void testNoCredentials() { + itestNoCredentials(Boolean.FALSE); + } + + public void itestNoCredentials(Boolean multiUser) { + CredentialGenerator gen = new DummyCredentialGenerator(); + Properties extraProps = gen.getSystemProperties(); + Properties javaProps = gen.getJavaProperties(); + String authenticator = gen.getAuthenticator(); + String authInit = gen.getAuthInit(); + + getLogWriter() + .info("testNoCredentials: Using scheme: " + gen.classCode()); + getLogWriter().info( + "testNoCredentials: Using authenticator: " + authenticator); + getLogWriter().info("testNoCredentials: Using authinit: " + authInit); + + // Start the servers + Integer locPort1 = SecurityTestUtil.getLocatorPort(); + Integer locPort2 = SecurityTestUtil.getLocatorPort(); + String locString = SecurityTestUtil.getLocatorString(); + Integer port1 = ((Integer)server1.invoke( + ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort1, locString, authenticator, extraProps, + javaProps })); + Integer port2 = ((Integer)server2.invoke( + ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort2, locString, authenticator, extraProps, + javaProps })); + + // Start first client with valid credentials + Properties credentials1 = gen.getValidCredentials(1); + Properties javaProps1 = gen.getJavaProperties(); + getLogWriter().info( + "testNoCredentials: For first client credentials: " + credentials1 + + " : " + javaProps1); + client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials1, javaProps1, port1, port2, + null, multiUser, new Integer(SecurityTestUtil.NO_EXCEPTION) }); + + // Perform some put operations from client1 + client1.invoke(SecurityTestUtil.class, "doPuts", + new Object[] { new Integer(2) }); + + // Trying to create the region on client2 + if (gen.classCode().equals(ClassCode.SSL)) { + // For SSL the exception may not come since the server can close socket + // before handshake message is sent from client. However exception + // should come in any region operations. + client2 + .invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { null, null, null, port1, port2, null, multiUser, + new Integer(SecurityTestUtil.NO_EXCEPTION) }); + client2.invoke(SecurityTestUtil.class, "doPuts", new Object[] { + new Integer(2), new Integer(SecurityTestUtil.OTHER_EXCEPTION) }); + } + else { + client2.invoke(ClientAuthenticationDUnitTest.class, + "createCacheClient", new Object[] { null, null, null, port1, port2, + null, multiUser, new Integer(SecurityTestUtil.AUTHREQ_EXCEPTION) }); + } + } + + public void testInvalidCredentials() { + itestInvalidCredentials(Boolean.FALSE); + } + + public void itestInvalidCredentials(Boolean multiUser) { + + + CredentialGenerator gen = new DummyCredentialGenerator(); + Properties extraProps = gen.getSystemProperties(); + Properties javaProps = gen.getJavaProperties(); + String authenticator = gen.getAuthenticator(); + String authInit = gen.getAuthInit(); + + getLogWriter().info( + "testInvalidCredentials: Using scheme: " + gen.classCode()); + getLogWriter().info( + "testInvalidCredentials: Using authenticator: " + authenticator); + getLogWriter() + .info("testInvalidCredentials: Using authinit: " + authInit); + + // Start the servers + Integer locPort1 = SecurityTestUtil.getLocatorPort(); + Integer locPort2 = SecurityTestUtil.getLocatorPort(); + String locString = SecurityTestUtil.getLocatorString(); + Integer port1 = ((Integer)server1.invoke( + ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort1, locString, authenticator, extraProps, + javaProps })); + Integer port2 = ((Integer)server2.invoke( + ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort2, locString, authenticator, extraProps, + javaProps })); + + // Start first client with valid credentials + Properties credentials1 = gen.getValidCredentials(1); + Properties javaProps1 = gen.getJavaProperties(); + getLogWriter().info( + "testInvalidCredentials: For first client credentials: " + + credentials1 + " : " + javaProps1); + client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials1, javaProps1, port1, port2, + null, multiUser, new Integer(SecurityTestUtil.NO_EXCEPTION) }); + + // Perform some put operations from client1 + client1.invoke(SecurityTestUtil.class, "doPuts", + new Object[] { new Integer(2) }); + + // Start second client with invalid credentials + // Trying to create the region on client2 should throw a security + // exception + Properties credentials2 = gen.getInvalidCredentials(1); + Properties javaProps2 = gen.getJavaProperties(); + getLogWriter().info( + "testInvalidCredentials: For second client credentials: " + + credentials2 + " : " + javaProps2); + client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials2, javaProps2, port1, port2, + null, multiUser, new Integer(SecurityTestUtil.AUTHFAIL_EXCEPTION) }); + } + + public void testInvalidAuthInit() { + itestInvalidAuthInit(Boolean.FALSE); + } + + public void itestInvalidAuthInit(Boolean multiUser) { + + CredentialGenerator gen = new DummyCredentialGenerator(); + Properties extraProps = gen.getSystemProperties(); + Properties javaProps = gen.getJavaProperties(); + String authenticator = gen.getAuthenticator(); + + getLogWriter().info( + "testInvalidAuthInit: Using scheme: " + gen.classCode()); + getLogWriter().info( + "testInvalidAuthInit: Using authenticator: " + authenticator); + + // Start the server + Integer locPort1 = SecurityTestUtil.getLocatorPort(); + String locString = SecurityTestUtil.getLocatorString(); + Integer port1 = ((Integer)server1.invoke( + ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort1, locString, authenticator, extraProps, + javaProps })); + + Properties credentials = gen.getValidCredentials(1); + javaProps = gen.getJavaProperties(); + getLogWriter().info( + "testInvalidAuthInit: For first client credentials: " + credentials + + " : " + javaProps); + client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { "com.gemstone.none", credentials, javaProps, + new Integer[] { port1 }, null, multiUser, + Integer.valueOf(SecurityTestUtil.AUTHREQ_EXCEPTION) }); + } + + public void testNoAuthInitWithCredentials() { + itestNoAuthInitWithCredentials(Boolean.FALSE); + } + + public void itestNoAuthInitWithCredentials(Boolean multiUser) { + + CredentialGenerator gen = new DummyCredentialGenerator(); + Properties extraProps = gen.getSystemProperties(); + Properties javaProps = gen.getJavaProperties(); + String authenticator = gen.getAuthenticator(); + + + getLogWriter().info( + "testNoAuthInitWithCredentials: Using scheme: " + gen.classCode()); + getLogWriter().info( + "testNoAuthInitWithCredentials: Using authenticator: " + + authenticator); + + // Start the servers + Integer locPort1 = SecurityTestUtil.getLocatorPort(); + Integer locPort2 = SecurityTestUtil.getLocatorPort(); + String locString = SecurityTestUtil.getLocatorString(); + Integer port1 = ((Integer)server1.invoke( + ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort1, locString, authenticator, extraProps, + javaProps })); + Integer port2 = ((Integer)server2.invoke( + ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort2, locString, authenticator, extraProps, + javaProps })); + + // Start the clients with valid credentials + Properties credentials1 = gen.getValidCredentials(1); + Properties javaProps1 = gen.getJavaProperties(); + getLogWriter().info( + "testNoAuthInitWithCredentials: For first client credentials: " + + credentials1 + " : " + javaProps1); + Properties credentials2 = gen.getValidCredentials(2); + Properties javaProps2 = gen.getJavaProperties(); + getLogWriter().info( + "testNoAuthInitWithCredentials: For second client credentials: " + + credentials2 + " : " + javaProps2); + client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { null, credentials1, javaProps1, port1, port2, null, + multiUser, new Integer(SecurityTestUtil.AUTHREQ_EXCEPTION) }); + client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { null, credentials2, javaProps2, port1, port2, null, + multiUser, new Integer(SecurityTestUtil.AUTHREQ_EXCEPTION) }); + client2.invoke(SecurityTestUtil.class, "closeCache"); + + + // Now also try with invalid credentials + credentials2 = gen.getInvalidCredentials(5); + javaProps2 = gen.getJavaProperties(); + client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { null, credentials2, javaProps2, port1, port2, null, + multiUser, new Integer(SecurityTestUtil.AUTHREQ_EXCEPTION) }); + } + + public void testInvalidAuthenticator() { + itestInvalidAuthenticator(Boolean.FALSE); + } + + public void itestInvalidAuthenticator(Boolean multiUser) { + + CredentialGenerator gen = new DummyCredentialGenerator(); + Properties extraProps = gen.getSystemProperties(); + Properties javaProps = gen.getJavaProperties(); + String authInit = gen.getAuthInit(); + + getLogWriter().info( + "testInvalidAuthenticator: Using scheme: " + gen.classCode()); + getLogWriter().info( + "testInvalidAuthenticator: Using authinit: " + authInit); + + // Start the server with invalid authenticator + Integer locPort1 = SecurityTestUtil.getLocatorPort(); + String locString = SecurityTestUtil.getLocatorString(); + Integer port1 = (Integer)server1.invoke( + ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort1, locString, "com.gemstone.gemfire.none", + extraProps, javaProps }); + + // Trying to create the region on client should throw a security exception + Properties credentials = gen.getValidCredentials(1); + javaProps = gen.getJavaProperties(); + getLogWriter().info( + "testInvalidAuthenticator: For first client credentials: " + + credentials + " : " + javaProps); + client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials, javaProps, port1, null, + new Integer(SecurityTestUtil.AUTHFAIL_EXCEPTION) }); + client1.invoke(SecurityTestUtil.class, "closeCache"); + + + // Also test with invalid credentials + credentials = gen.getInvalidCredentials(1); + javaProps = gen.getJavaProperties(); + getLogWriter().info( + "testInvalidAuthenticator: For first client credentials: " + + credentials + " : " + javaProps); + client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials, javaProps, port1, null, + new Integer(SecurityTestUtil.AUTHFAIL_EXCEPTION) }); + } + + public void testNoAuthenticatorWithCredentials() { + itestNoAuthenticatorWithCredentials(Boolean.FALSE); + } + + public void itestNoAuthenticatorWithCredentials(Boolean multiUser) { + + CredentialGenerator gen = new DummyCredentialGenerator(); + Properties extraProps = gen.getSystemProperties(); + Properties javaProps = gen.getJavaProperties(); + String authenticator = gen.getAuthenticator(); + String authInit = gen.getAuthInit(); + + getLogWriter().info( + "testNoAuthenticatorWithCredentials: Using scheme: " + + gen.classCode()); + getLogWriter().info( + "testNoAuthenticatorWithCredentials: Using authinit: " + authInit); + + // Start the servers with no authenticator + Integer locPort1 = SecurityTestUtil.getLocatorPort(); + Integer locPort2 = SecurityTestUtil.getLocatorPort(); + String locString = SecurityTestUtil.getLocatorString(); + Integer port1 = (Integer)server1.invoke( + ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort1, locString, null, extraProps, javaProps }); + Integer port2 = (Integer)server2.invoke( + ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort2, locString, null, extraProps, javaProps }); + + // Clients should connect successfully and work properly with + // valid/invalid credentials when none are required on the server side + Properties credentials1 = gen.getValidCredentials(3); + Properties javaProps1 = gen.getJavaProperties(); + getLogWriter().info( + "testNoAuthenticatorWithCredentials: For first client credentials: " + + credentials1 + " : " + javaProps1); + Properties credentials2 = gen.getInvalidCredentials(5); + Properties javaProps2 = gen.getJavaProperties(); + getLogWriter().info( + "testNoAuthenticatorWithCredentials: For second client credentials: " + + credentials2 + " : " + javaProps2); + client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials1, javaProps1, port1, port2, + null, multiUser, new Integer(SecurityTestUtil.NO_EXCEPTION) }); + client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials2, javaProps2, port1, port2, + null, multiUser, new Integer(SecurityTestUtil.NO_EXCEPTION) }); + + // Perform some put operations from client1 + client1.invoke(SecurityTestUtil.class, "doPuts", + new Object[] { new Integer(2) }); + + // Verify that the puts succeeded + client2.invoke(SecurityTestUtil.class, "doGets", + new Object[] { new Integer(2) }); + } + + public void testCredentialsWithFailover() { + itestCredentialsWithFailover(Boolean.FALSE); + } + + public void itestCredentialsWithFailover(Boolean multiUser) { + CredentialGenerator gen = new DummyCredentialGenerator(); + Properties extraProps = gen.getSystemProperties(); + Properties javaProps = gen.getJavaProperties(); + String authenticator = gen.getAuthenticator(); + String authInit = gen.getAuthInit(); + + getLogWriter().info( + "testCredentialsWithFailover: Using scheme: " + gen.classCode()); + getLogWriter().info( + "testCredentialsWithFailover: Using authenticator: " + authenticator); + getLogWriter().info( + "testCredentialsWithFailover: Using authinit: " + authInit); + + // Start the first server + Integer locPort1 = SecurityTestUtil.getLocatorPort(); + Integer locPort2 = SecurityTestUtil.getLocatorPort(); + String locString = SecurityTestUtil.getLocatorString(); + Integer port1 = (Integer)server1.invoke( + ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort1, locString, authenticator, extraProps, + javaProps }); + // Get a port for second server but do not start it + // This forces the clients to connect to the first server + Integer port2 = new Integer(AvailablePort + .getRandomAvailablePort(AvailablePort.SOCKET)); + + // Start the clients with valid credentials + Properties credentials1 = gen.getValidCredentials(5); + Properties javaProps1 = gen.getJavaProperties(); + getLogWriter().info( + "testCredentialsWithFailover: For first client credentials: " + + credentials1 + " : " + javaProps1); + Properties credentials2 = gen.getValidCredentials(6); + Properties javaProps2 = gen.getJavaProperties(); + getLogWriter().info( + "testCredentialsWithFailover: For second client credentials: " + + credentials2 + " : " + javaProps2); + client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials1, javaProps1, port1, port2, + null, multiUser, new Integer(SecurityTestUtil.NO_EXCEPTION) }); + client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials2, javaProps2, port1, port2, + null, multiUser, new Integer(SecurityTestUtil.NO_EXCEPTION) }); + + // Perform some put operations from client1 + client1.invoke(SecurityTestUtil.class, "doPuts", + new Object[] { new Integer(2) }); + // Verify that the puts succeeded + client2.invoke(SecurityTestUtil.class, "doGets", + new Object[] { new Integer(2) }); + + // start the second one and stop the first server to force a failover + server2.invoke(ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort2, locString, port2, authenticator, extraProps, + javaProps }); + server1.invoke(SecurityTestUtil.class, "closeCache"); + + // Perform some create/update operations from client1 + client1.invoke(SecurityTestUtil.class, "doNPuts", + new Object[] { new Integer(4) }); + // Verify that the creates/updates succeeded + client2.invoke(SecurityTestUtil.class, "doNGets", + new Object[] { new Integer(4) }); + + // Try to connect client2 with no credentials + // Verify that the creation of region throws security exception + if (gen.classCode().equals(ClassCode.SSL)) { + // For SSL the exception may not come since the server can close socket + // before handshake message is sent from client. However exception + // should come in any region operations. + client2 + .invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { null, null, null, port1, port2, null, multiUser, + new Integer(SecurityTestUtil.NOFORCE_AUTHREQ_EXCEPTION) }); + client2.invoke(SecurityTestUtil.class, "doPuts", new Object[] { + new Integer(2), new Integer(SecurityTestUtil.OTHER_EXCEPTION) }); + } + else { + client2.invoke(ClientAuthenticationDUnitTest.class, + "createCacheClient", new Object[] { null, null, null, port1, port2, + null, multiUser, new Integer(SecurityTestUtil.AUTHREQ_EXCEPTION) }); + } + + // Now try to connect client1 with invalid credentials + // Verify that the creation of region throws security exception + credentials1 = gen.getInvalidCredentials(7); + javaProps1 = gen.getJavaProperties(); + getLogWriter().info( + "testCredentialsWithFailover: For first client invalid credentials: " + + credentials1 + " : " + javaProps1); + client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials1, javaProps1, port1, port2, + null, multiUser, new Integer(SecurityTestUtil.AUTHFAIL_EXCEPTION) }); + + if (multiUser) { + client1.invoke(SecurityTestUtil.class, "doProxyCacheClose"); + client2.invoke(SecurityTestUtil.class, "doProxyCacheClose"); + client1.invoke(SecurityTestUtil.class, "doSimplePut", + new Object[] {"CacheClosedException"}); + client2.invoke(SecurityTestUtil.class, "doSimpleGet", + new Object[] {"CacheClosedException"}); + } + } + + public void testCredentialsForNotifications() { + itestCredentialsForNotifications(Boolean.FALSE); + } + + public void itestCredentialsForNotifications(Boolean multiUser) { + CredentialGenerator gen = new DummyCredentialGenerator(); + Properties extraProps = gen.getSystemProperties(); + Properties javaProps = gen.getJavaProperties(); + String authenticator = gen.getAuthenticator(); + String authInit = gen.getAuthInit(); + + getLogWriter().info( + "testCredentialsForNotifications: Using scheme: " + gen.classCode()); + getLogWriter().info( + "testCredentialsForNotifications: Using authenticator: " + + authenticator); + getLogWriter().info( + "testCredentialsForNotifications: Using authinit: " + authInit); + + // Start the first server + Integer locPort1 = SecurityTestUtil.getLocatorPort(); + Integer locPort2 = SecurityTestUtil.getLocatorPort(); + String locString = SecurityTestUtil.getLocatorString(); + Integer port1 = (Integer)server1.invoke( + ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort1, locString, authenticator, extraProps, + javaProps }); + // Get a port for second server but do not start it + // This forces the clients to connect to the first server + Integer port2 = new Integer(AvailablePort + .getRandomAvailablePort(AvailablePort.SOCKET)); + + // Start the clients with valid credentials + Properties credentials1 = gen.getValidCredentials(3); + Properties javaProps1 = gen.getJavaProperties(); + getLogWriter().info( + "testCredentialsForNotifications: For first client credentials: " + + credentials1 + " : " + javaProps1); + Properties credentials2 = gen.getValidCredentials(4); + Properties javaProps2 = gen.getJavaProperties(); + getLogWriter().info( + "testCredentialsForNotifications: For second client credentials: " + + credentials2 + " : " + javaProps2); + client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials1, javaProps1, port1, port2, + null, multiUser, new Integer(SecurityTestUtil.NO_EXCEPTION) }); + // Set up zero forward connections to check notification handshake only + Object zeroConns = new Integer(0); + client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials2, javaProps2, port1, port2, + zeroConns, multiUser, new Integer(SecurityTestUtil.NO_EXCEPTION) }); + + // Register interest on all keys on second client + client2 + .invoke(ClientAuthenticationDUnitTest.class, "registerAllInterest"); + + // Perform some put operations from client1 + client1.invoke(SecurityTestUtil.class, "doPuts", + new Object[] { new Integer(2) }); + + // Verify that the puts succeeded + client2.invoke(SecurityTestUtil.class, "doLocalGets", + new Object[] { new Integer(2) }); + + // start the second one and stop the first server to force a failover + server2.invoke(ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort2, locString, port2, authenticator, extraProps, + javaProps }); + server1.invoke(SecurityTestUtil.class, "closeCache"); + + // Wait for failover to complete + pause(500); + + // Perform some create/update operations from client1 + client1.invoke(SecurityTestUtil.class, "doNPuts", + new Object[] { new Integer(4) }); + // Verify that the creates/updates succeeded + client2.invoke(SecurityTestUtil.class, "doNLocalGets", + new Object[] { new Integer(4) }); + + // Try to connect client1 with no credentials + // Verify that the creation of region throws security exception + server1.invoke(ClientAuthenticationDUnitTest.class, "createCacheServer", + new Object[] { locPort1, locString, port1, authenticator, extraProps, + javaProps }); + if (gen.classCode().equals(ClassCode.SSL)) { + // For SSL the exception may not come since the server can close socket + // before handshake message is sent from client. However exception + // should come in any region operations. + client1.invoke(ClientAuthenticationDUnitTest.class, + "createCacheClient", new Object[] { null, null, null, port1, port2, + zeroConns, multiUser, + new Integer(SecurityTestUtil.NOFORCE_AUTHREQ_EXCEPTION) }); + client1.invoke(SecurityTestUtil.class, "doPuts", new Object[] { + new Integer(2), new Integer(SecurityTestUtil.OTHER_EXCEPTION) }); + } + else { + client1.invoke(ClientAuthenticationDUnitTest.class, + "createCacheClient", new Object[] { null, null, null, port1, port2, + zeroConns, multiUser, new Integer(SecurityTestUtil.AUTHREQ_EXCEPTION) }); + } + + // Now try to connect client2 with invalid credentials + // Verify that the creation of region throws security exception + credentials2 = gen.getInvalidCredentials(3); + javaProps2 = gen.getJavaProperties(); + getLogWriter().info( + "testCredentialsForNotifications: For second client invalid credentials: " + + credentials2 + " : " + javaProps2); + client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { authInit, credentials2, javaProps2, port1, port2, + zeroConns, multiUser, new Integer(SecurityTestUtil.AUTHFAIL_EXCEPTION) }); + + // Now try to connect client2 with invalid auth-init method + // Trying to create the region on client with valid credentials should + // throw a security exception + client2 + .invoke(ClientAuthenticationDUnitTest.class, "createCacheClient", + new Object[] { "com.gemstone.none", credentials1, javaProps1, + port1, port2, zeroConns, multiUser, + new Integer(SecurityTestUtil.AUTHREQ_EXCEPTION) }); + + // Now start the servers with invalid authenticator method. + // Skip this test for a scheme which does not have an authInit in the + // first place (e.g. SSL) since that will fail with AuthReqEx before + // authenticator is even invoked. + if (authInit != null && authInit.length() > 0) { + server1.invoke(ClientAuthenticationDUnitTest.class, + "createCacheServer", new Object[] { locPort1, locString, port1, + "com.gemstone.gemfire.none", extraProps, javaProps }); + server2.invoke(ClientAuthenticationDUnitTest.class, + "createCacheServer", new Object[] { locPort2, locString, port2, + "com.gemstone.gemfire.none", extraProps, javaProps }); + + // Trying to create the region on client with valid/invalid credentials + // should throw a security exception + client2.invoke(ClientAuthenticationDUnitTest.class, + "createCacheClient", new Object[] { authInit, credentials1, + javaProps1, port1, port2, zeroConns, multiUser, + new Integer(SecurityTestUtil.AUTHFAIL_EXCEPTION) }); + client1.invoke(ClientAuthenticationDUnitTest.class, + "createCacheClient", new Object[] { authInit, credentials2, + javaProps2, port1, port2, zeroConns, multiUser, + new Integer(SecurityTestUtil.AUTHFAIL_EXCEPTION) }); + } + else { + getLogWriter().info( + "testCredentialsForNotifications: Skipping invalid authenticator for scheme [" + + gen.classCode() + "] which has no authInit"); + } + + // Try connection with null auth-init on clients. + // Skip this test for a scheme which does not have an authInit in the + // first place (e.g. SSL). + if (authInit != null && authInit.length() > 0) { + server1.invoke(ClientAuthenticationDUnitTest.class, + "createCacheServer", new Object[] { locPort1, locString, port1, + authenticator, extraProps, javaProps }); + server2.invoke(ClientAuthenticationDUnitTest.class, + "createCacheServer", new Object[] { locPort2, locString, port2, + authenticator, extraProps, javaProps }); + client1.invoke(ClientAuthenticationDUnitTest.class, + "createCacheClient", new Object[] { null, credentials1, javaProps1, + port1, port2, null, multiUser, + new Integer(SecurityTestUtil.AUTHREQ_EXCEPTION) }); + client2.invoke(ClientAuthenticationDUnitTest.class, + "createCacheClient", new Object[] { null, credentials2, javaProps2, + port1, port2, zeroConns, multiUser, + new Integer(SecurityTestUtil.AUTHREQ_EXCEPTION) }); + + // Now also try with invalid credentials on client2 + client2.invoke(ClientAuthenticationDUnitTest.class, + "createCacheClient", new Object[] { null, credentials2, javaProps2, + port1, port2, zeroConns, multiUser, + new Integer(SecurityTestUtil.AUTHREQ_EXCEPTION) }); + } + else { + getLogWriter().info( + "testCredentialsForNotifications: Skipping null authInit for scheme [" + + gen.classCode() + "] which has no authInit"); + } + + // Try connection with null authenticator on server and sending + // valid/invalid credentials. + // If the scheme does not have an authenticator in the first place (e.g. + // SSL) then skip it since this test is useless. + if (authenticator != null && authenticator.length() > 0) { + server1.invoke(ClientAuthenticationDUnitTest.class, + "createCacheServer", new Object[] { locPort1, locString, port1, + null, extraProps, javaProps }); + server2.invoke(ClientAuthenticationDUnitTest.class, + "createCacheServer", new Object[] { locPort2, locString, port2, + null, extraProps, javaProps }); + client1.invoke(ClientAuthenticationDUnitTest.class, + "createCacheClient", new Object[] { authInit, credentials1, + javaProps1, port1, port2, null, multiUser, + new Integer(SecurityTestUtil.NO_EXCEPTION) }); + client2.invoke(ClientAuthenticationDUnitTest.class, + "createCacheClient", new Object[] { authInit, credentials2, + javaProps2, port1, port2, zeroConns, multiUser, + new Integer(SecurityTestUtil.NO_EXCEPTION) }); + + // Register interest on all keys on second client + client2.invoke(ClientAuthenticationDUnitTest.class, + "registerAllInterest"); + + // Perform some put operations from client1 + client1.invoke(SecurityTestUtil.class, "doPuts", + new Object[] { new Integer(4) }); + + // Verify that the puts succeeded + client2.invoke(SecurityTestUtil.class, "doLocalGets", + new Object[] { new Integer(4) }); + + // Now also try with valid credentials on client2 + client1.invoke(ClientAuthenticationDUnitTest.class, + "createCacheClient", new Object[] { authInit, credentials2, + javaProps2, port1, port2, null, multiUser, + new Integer(SecurityTestUtil.NO_EXCEPTION) }); + client2.invoke(ClientAuthenticationDUnitTest.class, + "createCacheClient", new Object[] { authInit, credentials1, + javaProps1, port1, port2, zeroConns, multiUser, + new Integer(SecurityTestUtil.NO_EXCEPTION) }); + + // Register interest on all keys on second client + client2.invoke(ClientAuthenticationDUnitTest.class, + "registerAllInterest"); + + // Perform some put operations from client1 + client1.invoke(SecurityTestUtil.class, "doNPuts", + new Object[] { new Integer(4) }); + + // Verify that the puts succeeded + client2.invoke(SecurityTestUtil.class, "doNLocalGets", + new Object[] { new Integer(4) }); + } + else { + getLogWriter().info( + "testCredentialsForNotifications: Skipping scheme [" + + gen.classCode() + "] which has no authenticator"); + } + } + + ////////////////////////////////////////////////////////////////////////////// + // Tests for MULTI_USER_MODE start here + ////////////////////////////////////////////////////////////////////////////// + + public void xtestValidCredentialsForMultipleUsers() { + itestValidCredentials(Boolean.TRUE); + } + + ////////////////////////////////////////////////////////////////////////////// + // Tests for MULTI_USER_MODE end here + ////////////////////////////////////////////////////////////////////////////// + + @Override + public void tearDown2() throws Exception { + + super.tearDown2(); + // close the clients first + client1.invoke(SecurityTestUtil.class, "closeCache"); + client2.invoke(SecurityTestUtil.class, "closeCache"); + // then close the servers + server1.invoke(SecurityTestUtil.class, "closeCache"); + server2.invoke(SecurityTestUtil.class, "closeCache"); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a622d6ec/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationPart2DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationPart2DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationPart2DUnitTest.java new file mode 100644 index 0000000..138114a --- /dev/null +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationPart2DUnitTest.java @@ -0,0 +1,88 @@ + +package com.gemstone.gemfire.security; + +/* + * 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. + */ + + +/** + * this class contains test methods that used to be in its superclass but + * that test started taking too long and caused dunit runs to hang + */ +public class ClientAuthenticationPart2DUnitTest extends + ClientAuthenticationDUnitTest { + + /** constructor */ + public ClientAuthenticationPart2DUnitTest(String name) { + super(name); + } + + // override inherited tests so they aren't executed again + + @Override + public void testValidCredentials() { } + @Override + public void testNoCredentials() { } + @Override + public void testInvalidCredentials() { } + @Override + public void testInvalidAuthInit() { } + @Override + public void testNoAuthInitWithCredentials() { } + @Override + public void testInvalidAuthenticator() { } + @Override + public void testNoAuthenticatorWithCredentials() { } + @Override + public void testCredentialsWithFailover() { } + @Override + public void testCredentialsForNotifications() { } + //@Override + public void testValidCredentialsForMultipleUsers() { } + + + + + + public void testNoCredentialsForMultipleUsers() { + itestNoCredentials(Boolean.TRUE); + } + public void testInvalidCredentialsForMultipleUsers() { + itestInvalidCredentials(Boolean.TRUE); + } + public void testInvalidAuthInitForMultipleUsers() { + itestInvalidAuthInit(Boolean.TRUE); + } + public void testNoAuthInitWithCredentialsForMultipleUsers() { + itestNoAuthInitWithCredentials(Boolean.TRUE); + } + public void testInvalidAuthenitcatorForMultipleUsers() { + itestInvalidAuthenticator(Boolean.TRUE); + } + public void testNoAuthenticatorWithCredentialsForMultipleUsers() { + itestNoAuthenticatorWithCredentials(Boolean.TRUE); + } + public void disabled_testCredentialsWithFailoverForMultipleUsers() { + itestCredentialsWithFailover(Boolean.TRUE); + } + public void __testCredentialsForNotificationsForMultipleUsers() { + itestCredentialsForNotifications(Boolean.TRUE); + } + +}