public DistributedSystem createSystem(final Properties sysProps, final Properties javaProps) { closeCache(); clearStaticSSLContext(); setJavaProps(javaProps); DistributedSystem dsys = distributedTestCase.getSystem(sysProps); assertNotNull(dsys); addIgnoredExceptions(ignoredExceptions); return dsys; }
protected static void setJavaProps(final Properties javaProps) { removeJavaProperties(currentJavaProps); addJavaProperties(javaProps); currentJavaProps = javaProps; }
protected static void createCacheClient(final String authInitModule, final Properties authProps, final Properties javaProps, final int[] ports, final int numConnections, final boolean setupDynamicRegionFactory, final boolean multiUserMode, final int expectedResult) { createCacheClient(authInitModule, authProps, javaProps, ports, numConnections, setupDynamicRegionFactory, multiUserMode, true, expectedResult); }
SecurityTestUtils tmpInstance = new SecurityTestUtils(); tmpInstance.createSystem(props, javaProps); tmpInstance.openCache(); initClientDynamicRegionFactory(pool.getName());
getLogWriter().info("Set the java properties to: " + javaProps); SecurityTestUtils tmpInstance = new SecurityTestUtils(); try { tmpInstance.createSystem(authProps, javaProps); } catch (AuthenticationRequiredException ex) { if (expectedResult == AUTHREQ_EXCEPTION) { initDynamicRegionFactory(); tmpInstance.openCache();
protected static void startLocator(final String name, int port, final Properties extraProps, final Properties javaProps, final String[] expectedExceptions) { try { Properties authProps = new Properties(); if (extraProps != null) { authProps.putAll(extraProps); } authProps.setProperty(MCAST_PORT, "0"); authProps.setProperty(LOCATORS, getIPLiteral() + "[" + port + "]"); authProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false"); clearStaticSSLContext(); setJavaProps(javaProps); File logFile = new File(name + "-locator" + port + ".log"); FileOutputStream logOut = new FileOutputStream(logFile); PrintStream logStream = new PrintStream(logOut); addIgnoredExceptions(expectedExceptions); logStream.flush(); locator = Locator.startLocatorAndDS(port, logFile, null, authProps); } catch (IOException ex) { fail("While starting locator on port " + port, ex); } }
concatProperties(new Properties[] {opCredentials, extraAuthProps, extraAuthzProps}); clientProps.put(ConfigurationProperties.SERIALIZABLE_OBJECT_FILTER, "org.apache.geode.security.templates.UsernamePrincipal"); SecurityTestUtils.createCacheClientWithDynamicRegion(authInit, clientProps, javaProps, 0, setupDynamicRegionFactory, NO_EXCEPTION); } else { SecurityTestUtils.createCacheClientWithDynamicRegion(authInit, clientProps, javaProps, 0, setupDynamicRegionFactory, NO_EXCEPTION); });
protected static Integer createCacheServer(final Properties authProps, final Properties javaProps) { return SecurityTestUtils.createCacheServer(authProps, javaProps, 0, true, NO_EXCEPTION); }
private final void tearDownClientAuthorizationTestBase() throws Exception { server1.invoke(() -> ServerConnection.allowInternalMessagesWithoutCredentials = true); server2.invoke(() -> ServerConnection.allowInternalMessagesWithoutCredentials = true); client1.invoke(() -> closeCache()); client2.invoke(() -> closeCache()); server1.invoke(() -> closeCache()); server2.invoke(() -> closeCache()); }
protected static void createCacheClientForMultiUserMode(final int numOfUsers, final String authInitModule, final Properties[] authProps, final Properties javaProps, final int[] ports, final int numConnections, final boolean setupDynamicRegionFactory, final int expectedResult) { createCacheClientForMultiUserMode(numOfUsers, authInitModule, authProps, javaProps, ports, numConnections, setupDynamicRegionFactory, null, expectedResult); }
protected static Properties buildProperties(final String authenticator, final String accessor, final boolean isAccessorPP, final Properties extraAuthProps, final Properties extraAuthzProps) { Properties authProps = new Properties(); if (authenticator != null) { authProps.setProperty(SECURITY_CLIENT_AUTHENTICATOR, authenticator); } if (accessor != null) { if (isAccessorPP) { authProps.setProperty(SECURITY_CLIENT_ACCESSOR_PP, accessor); } else { authProps.setProperty(SECURITY_CLIENT_ACCESSOR, accessor); } } if (Version.CURRENT_ORDINAL >= 75) { authProps.put(ConfigurationProperties.SERIALIZABLE_OBJECT_FILTER, UsernamePrincipal.class.getName()); } return concatProperties(new Properties[] {authProps, extraAuthProps, extraAuthzProps}); }
SecurityTestUtils tmpInstance = new SecurityTestUtils(); tmpInstance.createSystem(authProps, javaProps); initClientDynamicRegionFactory(pool.getName()); tmpInstance.openCache(); try { getLogWriter().info("multi-user mode " + multiUserAuthMode);
protected static int createCacheServer(final Properties authProps, final Properties javaProps, final int serverPort, final int expectedResult) { return createCacheServer(authProps, javaProps, serverPort, false, expectedResult); }
server2.invoke("closeCache", () -> closeCache()); server1.invoke("closeCache", () -> closeCache());
/** create a client cache using the dunit locator to find servers */ protected static void createCacheClientWithDynamicRegion(final String authInitModule, final Properties authProps, final Properties javaProps, final int numConnections, final boolean setupDynamicRegionFactory, final int expectedResult) { createCacheClient(authInitModule, authProps, javaProps, new int[0], numConnections, setupDynamicRegionFactory, false, expectedResult); }
protected static int createCacheServer(String authenticatorFactoryMethodName) { Properties authProps = new Properties(); authProps.setProperty(SECURITY_CLIENT_AUTHENTICATOR, authenticatorFactoryMethodName); return createCacheServer(authProps, null, 0, false, NO_EXCEPTION); }
protected static void createCacheClient(final String authInitModule, final Properties authProps, final Properties javaProps, final int[] ports, final int numConnections, final boolean multiUserMode, final int expectedResult) { createCacheClient(authInitModule, authProps, javaProps, ports, numConnections, false, multiUserMode, expectedResult); }
protected static int createCacheServer(final int serverPort, final Properties authProps, final Properties javaProps) { Properties jprops = javaProps; if (jprops == null) { jprops = new Properties(); } jprops.put(ConfigurationProperties.SERIALIZABLE_OBJECT_FILTER, "org.apache.geode.security.templates.UsernamePrincipal"); return SecurityTestUtils.createCacheServer(authProps, jprops, serverPort, true, NO_EXCEPTION); }
protected static void createCacheClient(final String authInitModule, final Properties authProps, final Properties javaProps, final int[] ports, final int numConnections, final int expectedResult) { createCacheClient(authInitModule, authProps, javaProps, ports, numConnections, false, expectedResult); }
protected static void createCacheClientWithDynamicRegion(final String authInitModule, final Properties authProps, final Properties javaProps, final int[] ports, final int numConnections, final boolean setupDynamicRegionFactory, final int expectedResult) { createCacheClient(authInitModule, authProps, javaProps, ports, numConnections, setupDynamicRegionFactory, false, expectedResult); }