Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setSslContextFactory()
The following examples show how to use
org.apache.ignite.configuration.IgniteConfiguration#setSslContextFactory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JdbcThinConnectionSSLTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @SuppressWarnings("deprecation") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setMarshaller(new BinaryMarshaller()); cfg.setClientConnectorConfiguration( new ClientConnectorConfiguration() .setSslEnabled(true) .setUseIgniteSslContextFactory(setSslCtxFactoryToIgnite) .setSslClientAuth(true) .setSslContextFactory(setSslCtxFactoryToCli ? sslCtxFactory : null)); cfg.setSslContextFactory(setSslCtxFactoryToIgnite ? sslCtxFactory : null); return cfg; }
Example 2
Source File: JdbcThinConnectionAdditionalSecurityTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @SuppressWarnings("deprecation") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setMarshaller(new BinaryMarshaller()); cfg.setPluginProviders(new TestAdditionalSecurityPluginProvider("srv_" + igniteInstanceName, null, ALLOW_ALL, false, true, clientData())); cfg.setClientConnectorConfiguration( new ClientConnectorConfiguration() .setSslEnabled(true) .setUseIgniteSslContextFactory(setSslCtxFactoryToIgnite) .setSslClientAuth(true) .setSslContextFactory(setSslCtxFactoryToCli ? sslCtxFactory : null)); cfg.setSslContextFactory(setSslCtxFactoryToIgnite ? sslCtxFactory : null); return cfg; }
Example 3
Source File: IgniteCommunicationBalanceTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); TcpCommunicationSpi commSpi = ((TcpCommunicationSpi)cfg.getCommunicationSpi()); commSpi.setSharedMemoryPort(-1); commSpi.setConnectionsPerNode(connectionsPerNode()); commSpi.setUsePairedConnections(usePairedConnections()); if (selectors > 0) commSpi.setSelectorsCount(selectors); if (sslEnabled()) cfg.setSslContextFactory(GridTestUtils.sslFactory()); return cfg; }
Example 4
Source File: MultipleSSLContextsTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration igniteCfg = super.getConfiguration(igniteInstanceName); if (clientMode) { igniteCfg.setClientMode(true); igniteCfg.setSslContextFactory(clientSSLFactory()); } else igniteCfg.setSslContextFactory(serverSSLFactory()); ClientConnectorConfiguration clientConnectorCfg = new ClientConnectorConfiguration() .setSslEnabled(true) .setSslClientAuth(true) .setUseIgniteSslContextFactory(false) .setSslContextFactory(clientConnectorSSLFactory()); igniteCfg.setClientConnectorConfiguration(clientConnectorCfg); ConnectorConfiguration connectorConfiguration = new ConnectorConfiguration() .setSslEnabled(true) .setSslFactory(connectorSSLFactory()); igniteCfg.setConnectorConfiguration(connectorConfiguration); return igniteCfg; }
Example 5
Source File: GridCommandHandlerSslTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setDataStorageConfiguration(new DataStorageConfiguration()); cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration().setMaxSize(100 * 1024 * 1024); cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration().setPersistenceEnabled(true); cfg.setConnectorConfiguration(new ConnectorConfiguration()); cfg.getConnectorConfiguration().setSslEnabled(true); cfg.setSslContextFactory(createSslFactory()); return cfg; }
Example 6
Source File: CommonSecurityCheckTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param instanceName Instance name. */ @Override protected IgniteConfiguration getConfiguration(String instanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(instanceName); cfg.setActiveOnStart(false); boolean isClient = instanceName.endsWith("2"); String name = isClient ? "client_" + instanceName : "srv_" + instanceName; cfg.setPluginProviders(getPluginProvider(name)); SslContextFactory sslFactory = (SslContextFactory) GridTestUtils.sslFactory(); cfg.setSslContextFactory(sslFactory); cfg.setConnectorConfiguration(new ConnectorConfiguration() .setSslEnabled(true) .setSslClientAuth(true) .setSslClientAuth(true) .setSslFactory(sslFactory)); cfg.setClientConnectorConfiguration(new ClientConnectorConfiguration() .setSslEnabled(true) .setSslClientAuth(true) .setUseIgniteSslContextFactory(false) .setSslContextFactory(sslFactory)); if (instanceName.endsWith("0")) cfg.setGridLogger(listeningLog); if (isClient) cfg.setClientMode(true); if (!fail) { Map<String, String> attrs = new UserAttributesFactory().create(); cfg.setUserAttributes(attrs); } return cfg; }
Example 7
Source File: TcpCommunicationSpiFaultyClientSslTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setSslContextFactory(GridTestUtils.sslFactory()); return cfg; }
Example 8
Source File: IgniteTcpCommunicationHandshakeWaitSslTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setSslContextFactory(GridTestUtils.sslFactory()); return cfg; }
Example 9
Source File: IgniteCacheSslStartStopSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setSslContextFactory(GridTestUtils.sslFactory()); return cfg; }
Example 10
Source File: TcpDiscoverySslTrustedSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setSslContextFactory(GridTestUtils.sslTrustedFactory("node02", "trustboth")); return cfg; }
Example 11
Source File: IgniteClientConnectSslTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setSslContextFactory(GridTestUtils.sslFactory()); return cfg; }
Example 12
Source File: IgniteClientReconnectMassiveShutdownSslTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setSslContextFactory(GridTestUtils.sslFactory()); return cfg; }
Example 13
Source File: TcpDiscoverySslSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setSslContextFactory(GridTestUtils.sslFactory()); return cfg; }
Example 14
Source File: TcpDiscoverySslTrustedUntrustedTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setSslContextFactory(GridTestUtils.sslTrustedFactory(keyStore, trustStore)); return cfg; }
Example 15
Source File: ClientSslParametersTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setSslContextFactory(createSslFactory()); cfg.setConnectorConfiguration(new ConnectorConfiguration() .setSslEnabled(true) .setSslClientAuth(true)); cfg.setCacheConfiguration(new CacheConfiguration(TEST_CACHE_NAME)); return cfg; }
Example 16
Source File: SslParametersTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setClientConnectorConfiguration(new ClientConnectorConfiguration() .setSslEnabled(true) .setUseIgniteSslContextFactory(true)); cfg.setSslContextFactory(createSslFactory()); CacheConfiguration ccfg = new CacheConfiguration(TEST_CACHE_NAME); cfg.setCacheConfiguration(ccfg); return cfg; }
Example 17
Source File: TcpDiscoverySslSecuredUnsecuredTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception { final IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setClientMode(gridName.contains("client")); if (gridName.contains("ssl")) cfg.setSslContextFactory(GridTestUtils.sslFactory()); if (spi != null) { final TcpDiscoveryIpFinder finder = ((TcpDiscoverySpi)cfg.getDiscoverySpi()).getIpFinder(); spi.setIpFinder(finder); cfg.setDiscoverySpi(spi); } return cfg; }
Example 18
Source File: GridCommandHandlerAbstractTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if (atomicConfiguration != null) cfg.setAtomicConfiguration(atomicConfiguration); cfg.setCommunicationSpi(new TestRecordingCommunicationSpi()); cfg.setConnectorConfiguration(new ConnectorConfiguration().setSslEnabled(sslEnabled())); if (sslEnabled()) cfg.setSslContextFactory(GridTestUtils.sslFactory()); DataStorageConfiguration dsCfg = new DataStorageConfiguration() .setWalMode(WALMode.LOG_ONLY) .setCheckpointFrequency(checkpointFreq) .setDefaultDataRegionConfiguration( new DataRegionConfiguration().setMaxSize(50L * 1024 * 1024).setPersistenceEnabled(persistent) ); if (dataRegionConfiguration != null) dsCfg.setDataRegionConfigurations(dataRegionConfiguration); cfg.setDataStorageConfiguration(dsCfg); cfg.setConsistentId(igniteInstanceName); cfg.setClientMode(igniteInstanceName.startsWith(CLIENT_NODE_NAME_PREFIX)); if (encriptionEnabled) { KeystoreEncryptionSpi encSpi = new KeystoreEncryptionSpi(); encSpi.setKeyStorePath(KEYSTORE_PATH); encSpi.setKeyStorePassword(KEYSTORE_PASSWORD.toCharArray()); cfg.setEncryptionSpi(encSpi); } return cfg; }
Example 19
Source File: SecurityTest.java From ignite with Apache License 2.0 | 4 votes |
/** Test SSL/TLS encryption. */ @Test public void testEncryption() throws Exception { // Server-side security configuration IgniteConfiguration srvCfg = Config.getServerConfiguration(); SslContextFactory sslCfg = new SslContextFactory(); Function<String, String> rsrcPath = rsrc -> Paths.get( IGNITE_HOME == null ? "." : IGNITE_HOME, "modules", "core", "src", "test", "resources", rsrc ).toString(); sslCfg.setKeyStoreFilePath(rsrcPath.apply("/server.jks")); sslCfg.setKeyStorePassword("123456".toCharArray()); sslCfg.setTrustStoreFilePath(rsrcPath.apply("/trust.jks")); sslCfg.setTrustStorePassword("123456".toCharArray()); srvCfg.setClientConnectorConfiguration(new ClientConnectorConfiguration() .setSslEnabled(true) .setSslClientAuth(true) ); srvCfg.setSslContextFactory(sslCfg); // Client-side security configuration ClientConfiguration clientCfg = new ClientConfiguration().setAddresses(Config.SERVER); try (Ignite ignored = Ignition.start(srvCfg)) { boolean failed; try (IgniteClient client = Ignition.startClient(clientCfg)) { client.<Integer, String>cache(Config.DEFAULT_CACHE_NAME).put(1, "1"); failed = false; } catch (Exception ex) { failed = true; } assertTrue("Client connection without SSL must fail", failed); // Not using user-supplied SSL Context Factory: try (IgniteClient client = Ignition.startClient(clientCfg .setSslMode(SslMode.REQUIRED) .setSslClientCertificateKeyStorePath(rsrcPath.apply("/client.jks")) .setSslClientCertificateKeyStoreType("JKS") .setSslClientCertificateKeyStorePassword("123456") .setSslTrustCertificateKeyStorePath(rsrcPath.apply("/trust.jks")) .setSslTrustCertificateKeyStoreType("JKS") .setSslTrustCertificateKeyStorePassword("123456") .setSslKeyAlgorithm("SunX509") .setSslTrustAll(false) .setSslProtocol(SslProtocol.TLS) )) { client.<Integer, String>cache(Config.DEFAULT_CACHE_NAME).put(1, "1"); } // Using user-supplied SSL Context Factory try (IgniteClient client = Ignition.startClient(clientCfg .setSslMode(SslMode.REQUIRED) .setSslContextFactory(sslCfg) )) { client.<Integer, String>cache(Config.DEFAULT_CACHE_NAME).put(1, "1"); } } }
Example 20
Source File: TcpDiscoverySslParametersTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); SslContextFactory factory = (SslContextFactory)GridTestUtils.sslTrustedFactory( "node01", "trustone"); factory.setCipherSuites(cipherSuites); factory.setProtocols(protocols); cfg.setSslContextFactory(factory); return cfg; }