Example usage for java.lang System getProperties

List of usage examples for java.lang System getProperties

Introduction

In this page you can find the example usage for java.lang System getProperties.

Prototype

public static Properties getProperties() 

Source Link

Document

Determines the current system properties.

Usage

From source file:io.fabric8.kubernetes.client.ConfigTest.java

@Before
public void setUp() {
    System.getProperties().remove(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_NAMESPACE_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_OAUTH_TOKEN_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_AUTH_BASIC_USERNAME_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_AUTH_BASIC_PASSWORD_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_DISABLE_HOSTNAME_VERIFICATION_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_CA_CERTIFICATE_FILE_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_CA_CERTIFICATE_DATA_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_CLIENT_CERTIFICATE_FILE_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_CLIENT_CERTIFICATE_DATA_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_CLIENT_KEY_FILE_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_CLIENT_KEY_DATA_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_CLIENT_KEY_ALGO_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_CLIENT_KEY_PASSPHRASE_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_CLIENT_KEY_FILE_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_WATCH_RECONNECT_INTERVAL_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_WATCH_RECONNECT_LIMIT_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_REQUEST_TIMEOUT_SYSTEM_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_HTTP_PROXY);
    System.getProperties().remove(Config.KUBERNETES_KUBECONFIG_FILE);
    System.getProperties().remove(Config.KUBERNETES_NAMESPACE_FILE);
    System.getProperties().remove(Config.KUBERNETES_TLS_VERSIONS);
    System.getProperties().remove(Config.KUBERNETES_TRUSTSTORE_FILE_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_TRUSTSTORE_PASSPHRASE_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_KEYSTORE_FILE_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_KEYSTORE_PASSPHRASE_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_SERVICE_HOST_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_SERVICE_PORT_PROPERTY);
    System.getProperties().remove(Config.KUBERNETES_IMPERSONATE_USERNAME);
    System.getProperties().remove(Config.KUBERNETES_IMPERSONATE_GROUP);
}

From source file:com.samples.platform.service.common.GetServiceStatusOperation.java

/**
 * @param message//from   w  w w  .  j a  v a 2 s .  c o  m
 *            the {@link JAXBElement} containing a
 *            {@link GetServiceStatusRequestType}.
 * @return the {@link JAXBElement} with a
 *         {@link GetServiceStatusResponseType}.
 */
@InsightEndPoint
@ServiceActivator
public final JAXBElement<GetServiceStatusResponseType> getServiceStatus(
        final JAXBElement<GetServiceStatusRequestType> message) {
    this.logger.debug("+getServiceStatus");
    GetServiceStatusResponseType response = this.of.createGetServiceStatusResponseType();
    try {
        PropertyType p;
        ClassLoader cl;
        URL[] urls;
        ClassLoader sysCl = ClassLoader.getSystemClassLoader();

        response.setStatus("Service is available");

        /* System properties */
        p = new PropertyType();
        p.setName("System Properties");
        response.getDetails().add(p);
        TreeSet<String> propertyNames = new TreeSet<String>();
        propertyNames.addAll(System.getProperties().stringPropertyNames());
        for (String propertyName : propertyNames) {
            p.getValue().add(new StringBuffer(64).append(propertyName).append("=")
                    .append(System.getProperty(propertyName)).toString());
        }

        /* Application properties. */
        p = new PropertyType();
        p.setName("Application loaded properties");
        response.getDetails().add(p);
        propertyNames.clear();
        propertyNames.addAll(this.properties.stringPropertyNames());
        for (String propertyName : propertyNames) {
            p.getValue().add(new StringBuffer(64).append(propertyName).append("=")
                    .append(this.properties.getProperty(propertyName)).toString());
        }

        /* Current lass loader */
        cl = this.getClass().getClassLoader();
        p = new PropertyType();
        p.setName("This ClassLoader");
        response.getDetails().add(p);
        p.getValue().add(cl.getClass().getName());
        if (URLClassLoader.class.isInstance(cl)) {
            urls = ((URLClassLoader) cl).getURLs();
            p.getValue().add(new StringBuffer("Url: ").append(urls.length).toString());
            for (URL url : urls) {
                p.getValue().add(url.toString());
            }
        }
        cl = cl.getParent();
        while (cl != sysCl) {
            p = new PropertyType();
            p.setName("Parent Classloader");
            response.getDetails().add(p);
            p.getValue().add(cl.getClass().getName());
            if (URLClassLoader.class.isInstance(cl)) {
                urls = ((URLClassLoader) cl).getURLs();
                p.getValue().add(new StringBuffer("Url: ").append(urls.length).toString());
                for (URL url : urls) {
                    p.getValue().add(url.toString());
                }
            }
            cl = cl.getParent();
        }

        /* System class loader */
        cl = sysCl;
        p = new PropertyType();
        p.setName("SystemClassLoader");
        response.getDetails().add(p);
        p.getValue().add(cl.getClass().getName());
        if (URLClassLoader.class.isInstance(cl)) {
            urls = ((URLClassLoader) cl).getURLs();
            p.getValue().add(new StringBuffer("Url: ").append(urls.length).toString());
            for (URL url : urls) {
                p.getValue().add(url.toString());
            }
        }
    } catch (Throwable e) {
        this.logger.error(e.getMessage(), e);
    } finally {
        this.logger.debug("-getServiceStatus #{}, #f{}", response/* .get() */ != null ? 1 : 0,
                response.getFailure().size());
    }
    return this.of.createGetServiceStatusResponse(response);
}

From source file:PropertiesHelper.java

/**
 * Adds new properties to an existing set of properties while
 * substituting variables. This function will allow value
 * substitutions based on other property values. Value substitutions
 * may not be nested. A value substitution will be ${property.key},
 * where the dollar-brace and close-brace are being stripped before
 * looking up the value to replace it with. Note that the ${..}
 * combination must be escaped from the shell.
 *
 * @param a is the initial set of known properties (besides System ones)
 * @param b is the set of properties to add to a
 * @return the combined set of properties from a and b.
 *//*from  w  w  w . j  av a 2  s  .  c  o m*/
protected static Properties addProperties(Properties a, Properties b) {
    // initial
    Properties result = new Properties(a);
    Properties sys = System.getProperties();
    Pattern pattern = Pattern.compile("\\$\\{[-a-zA-Z0-9._]+\\}");

    for (Enumeration e = b.propertyNames(); e.hasMoreElements();) {
        String key = (String) e.nextElement();
        String value = b.getProperty(key);

        // unparse value ${prop.key} inside braces
        Matcher matcher = pattern.matcher(value);
        StringBuffer sb = new StringBuffer();
        while (matcher.find()) {
            // extract name of properties from braces
            String newKey = value.substring(matcher.start() + 2, matcher.end() - 1);

            // try to find a matching value in result properties
            String newVal = result.getProperty(newKey);

            // if still not found, try system properties
            if (newVal == null) {
                newVal = sys.getProperty(newKey);
            }

            // replace braced string with the actual value or empty string
            matcher.appendReplacement(sb, newVal == null ? "" : newVal);
        }
        matcher.appendTail(sb);
        result.setProperty(key, sb.toString());
    }
    // final
    return result;
}

From source file:ch.cyberduck.core.cryptomator.B2WriteFeatureTest.java

@Test
public void testWrite() throws Exception {
    final Host host = new Host(new B2Protocol(), new B2Protocol().getDefaultHostname(), new Credentials(
            System.getProperties().getProperty("b2.user"), System.getProperties().getProperty("b2.key")));
    final B2Session session = new B2Session(host);
    session.open(new DisabledHostKeyCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final TransferStatus status = new TransferStatus();
    final int length = 1048576;
    final byte[] content = RandomUtils.nextBytes(length);
    status.setLength(content.length);/*from  w w  w  .  jav a  2  s  .  c o m*/
    final Path home = new Path("/test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    final CryptoVault cryptomator = new CryptoVault(
            new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)),
            new DisabledPasswordStore());
    final Path vault = cryptomator.create(session, null, new VaultCredentials("test"));
    final Path test = new Path(vault, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.file));
    session.withRegistry(
            new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    final CryptoWriteFeature<BaseB2Response> writer = new CryptoWriteFeature<BaseB2Response>(session,
            new B2WriteFeature(session), cryptomator);
    final Cryptor cryptor = cryptomator.getCryptor();
    final FileHeader header = cryptor.fileHeaderCryptor().create();
    status.setHeader(cryptor.fileHeaderCryptor().encryptHeader(header));
    status.setNonces(new RotatingNonceGenerator(cryptomator.numberOfChunks(content.length)));
    status.setChecksum(writer.checksum(test).compute(new ByteArrayInputStream(content), status));
    final OutputStream out = writer.write(test, status, new DisabledConnectionCallback());
    assertNotNull(out);
    new StreamCopier(status, status).transfer(new ByteArrayInputStream(content), out);
    out.close();
    assertTrue(new CryptoFindFeature(session, new B2FindFeature(session), cryptomator).find(test));
    assertEquals(content.length,
            new CryptoAttributesFeature(session, new B2AttributesFinderFeature(session), cryptomator).find(test)
                    .getSize());
    assertEquals(content.length, writer.append(test, status.getLength(), PathCache.empty()).size, 0L);
    final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length);
    final InputStream in = new CryptoReadFeature(session, new B2ReadFeature(session), cryptomator).read(test,
            new TransferStatus().length(content.length), new DisabledConnectionCallback());
    new StreamCopier(status, status).transfer(in, buffer);
    assertArrayEquals(content, buffer.toByteArray());
    new CryptoDeleteFeature(session, new B2DeleteFeature(session), cryptomator)
            .delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
    session.close();
}

From source file:com.comcast.cats.domain.configuration.CatsHome.java

public static void displaySystemProperties() {
    Properties props = System.getProperties();
    logger.info("Found " + Integer.toString(props.size()) + " System Properties!");

    Iterator<Entry<Object, Object>> iterator = props.entrySet().iterator();
    Entry<Object, Object> entry;

    while (iterator.hasNext()) {
        entry = iterator.next();/*from   w  ww.jav  a 2 s .co  m*/
        logger.info(entry.getKey() + "=" + entry.getValue());
    }
}

From source file:ch.cyberduck.core.cryptomator.S3WriteFeatureTest.java

@Test
public void testWrite() throws Exception {
    final Host host = new Host(new S3Protocol(), new S3Protocol().getDefaultHostname(), new Credentials(
            System.getProperties().getProperty("s3.key"), System.getProperties().getProperty("s3.secret")));
    final S3Session session = new S3Session(host);
    session.open(new DisabledHostKeyCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final TransferStatus status = new TransferStatus();
    final int length = 1048576;
    final byte[] content = RandomUtils.nextBytes(length);
    status.setLength(content.length);//from  w  w  w.ja va2s  .c o m
    final Path home = new Path("test-us-east-1-cyberduck", EnumSet.of(Path.Type.volume, Path.Type.directory));
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.directory));
    final Path test = new Path(vault, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.file));
    final CryptoVault cryptomator = new CryptoVault(vault, new DisabledPasswordStore());
    cryptomator.create(session, null, new VaultCredentials("test"));
    session.withRegistry(
            new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    final CryptoWriteFeature<StorageObject> writer = new CryptoWriteFeature<StorageObject>(session,
            new S3WriteFeature(session), cryptomator);
    final Cryptor cryptor = cryptomator.getCryptor();
    final FileHeader header = cryptor.fileHeaderCryptor().create();
    status.setHeader(cryptor.fileHeaderCryptor().encryptHeader(header));
    status.setNonces(new RotatingNonceGenerator(cryptomator.numberOfChunks(content.length)));
    status.setChecksum(writer.checksum(test).compute(new ByteArrayInputStream(content), status));
    final OutputStream out = writer.write(test, status, new DisabledConnectionCallback());
    assertNotNull(out);
    new StreamCopier(status, status).transfer(new ByteArrayInputStream(content), out);
    out.close();
    assertTrue(new CryptoFindFeature(session, new S3FindFeature(session), cryptomator).find(test));
    assertEquals(content.length,
            new CryptoAttributesFeature(session, new S3AttributesFinderFeature(session), cryptomator).find(test)
                    .getSize());
    assertEquals(content.length, writer.append(test, status.getLength(), PathCache.empty()).size, 0L);
    final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length);
    final InputStream in = new CryptoReadFeature(session, new S3ReadFeature(session), cryptomator).read(test,
            new TransferStatus().length(content.length), new DisabledConnectionCallback());
    new StreamCopier(status, status).transfer(in, buffer);
    assertArrayEquals(content, buffer.toByteArray());
    new CryptoDeleteFeature(session, new S3DefaultDeleteFeature(session), cryptomator)
            .delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
    session.close();
}

From source file:ch.cyberduck.core.cryptomator.FTPWriteFeatureTest.java

@Test
public void testWrite() throws Exception {
    final Host host = new Host(new FTPTLSProtocol(), "test.cyberduck.ch",
            new Credentials(System.getProperties().getProperty("ftp.user"),
                    System.getProperties().getProperty("ftp.password")));
    final FTPSession session = new FTPSession(host);
    session.open(new DisabledHostKeyCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final TransferStatus status = new TransferStatus();
    final int length = 1048576;
    final byte[] content = RandomUtils.nextBytes(length);
    status.setLength(content.length);/*from  w  w w. j a v a2  s.c  o m*/
    final Path home = new DefaultHomeFinderService(session).find();
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.directory));
    final Path test = new Path(vault, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.file));
    final CryptoVault cryptomator = new CryptoVault(vault, new DisabledPasswordStore());
    cryptomator.create(session, null, new VaultCredentials("test"));
    session.withRegistry(
            new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    final CryptoWriteFeature<Integer> writer = new CryptoWriteFeature<Integer>(session,
            new FTPWriteFeature(session), cryptomator);
    final Cryptor cryptor = cryptomator.getCryptor();
    final FileHeader header = cryptor.fileHeaderCryptor().create();
    status.setHeader(cryptor.fileHeaderCryptor().encryptHeader(header));
    status.setNonces(new RotatingNonceGenerator(cryptomator.numberOfChunks(content.length)));
    status.setChecksum(writer.checksum(test).compute(new ByteArrayInputStream(content), status));
    final OutputStream out = writer.write(test, status, new DisabledConnectionCallback());
    assertNotNull(out);
    new StreamCopier(status, status).transfer(new ByteArrayInputStream(content), out);
    out.close();
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test));
    assertEquals(content.length, new CryptoListService(session, session, cryptomator)
            .list(test.getParent(), new DisabledListProgressListener()).get(test).attributes().getSize());
    assertEquals(content.length, new CryptoWriteFeature<>(session, new FTPWriteFeature(session), cryptomator)
            .append(test, status.getLength(), PathCache.empty()).size, 0L);
    final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length);
    final InputStream in = new CryptoReadFeature(session, new FTPReadFeature(session), cryptomator).read(test,
            new TransferStatus().length(content.length), new DisabledConnectionCallback());
    new StreamCopier(status, status).transfer(in, buffer);
    assertArrayEquals(content, buffer.toByteArray());
    new CryptoDeleteFeature(session, new FTPDeleteFeature(session), cryptomator)
            .delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
    session.close();
}

From source file:ch.cyberduck.core.cryptomator.SingleTransferWorkerTest.java

@Test
public void testUpload() throws Exception {
    final Host host = new Host(new DAVProtocol(), "test.cyberduck.ch",
            new Credentials(System.getProperties().getProperty("webdav.user"),
                    System.getProperties().getProperty("webdav.password")));
    host.setDefaultPath("/dav/basic");
    final DAVSession session = new DAVSession(host);
    session.open(new DisabledHostKeyCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path home = new DefaultHomeFinderService(session).find();
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.directory));
    final Path dir1 = new Path(vault, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.directory));
    final Local localDirectory1 = new Local(System.getProperty("java.io.tmpdir"),
            new AlphanumericRandomStringService().random());
    localDirectory1.mkdir();/*w ww  .ja v a 2  s.  com*/
    final byte[] content = RandomUtils.nextBytes(62768);
    final Path file1 = new Path(dir1, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.file));
    final Local localFile1 = new Local(localDirectory1, file1.getName());
    final OutputStream out1 = localFile1.getOutputStream(false);
    IOUtils.write(content, out1);
    out1.close();
    final Path file2 = new Path(dir1, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.file));
    final Local localFile2 = new Local(localDirectory1, file2.getName());
    final OutputStream out2 = localFile2.getOutputStream(false);
    IOUtils.write(content, out2);
    out2.close();
    final CryptoVault cryptomator = new CryptoVault(vault, new DisabledPasswordStore());
    cryptomator.create(session, null, new VaultCredentials("test"));
    session.withRegistry(new DefaultVaultRegistry(new DisabledPasswordStore(), new PasswordCallback() {
        @Override
        public Credentials prompt(final Host bookmark, final String title, final String reason,
                final LoginOptions options) throws LoginCanceledException {
            return new VaultCredentials("test");
        }
    }));
    PreferencesFactory.get().setProperty("factory.vault.class", CryptoVault.class.getName());
    final Transfer t = new UploadTransfer(new Host(new TestProtocol()),
            Collections.singletonList(new TransferItem(dir1, localDirectory1)), new NullFilter<>());
    assertTrue(new SingleTransferWorker(session, session, t, new TransferOptions(), new TransferSpeedometer(t),
            new DisabledTransferPrompt() {
                @Override
                public TransferAction prompt(final TransferItem file) {
                    return TransferAction.overwrite;
                }
            }, new DisabledTransferErrorCallback(), new DisabledProgressListener(),
            new DisabledStreamListener(), new DisabledLoginCallback(), new DisabledPasswordCallback()) {

    }.run(session, session));
    assertTrue(new CryptoFindFeature(session, new DAVFindFeature(session), cryptomator).find(dir1));
    assertEquals(content.length,
            new CryptoAttributesFeature(session, new DAVAttributesFinderFeature(session), cryptomator)
                    .find(file1).getSize());
    {
        final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length);
        final InputStream in = new CryptoReadFeature(session, new DAVReadFeature(session), cryptomator)
                .read(file1, new TransferStatus().length(content.length), new DisabledConnectionCallback());
        new StreamCopier(new TransferStatus(), new TransferStatus()).transfer(in, buffer);
        assertArrayEquals(content, buffer.toByteArray());
    }
    assertEquals(content.length,
            new CryptoAttributesFeature(session, new DAVAttributesFinderFeature(session), cryptomator)
                    .find(file2).getSize());
    {
        final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length);
        final InputStream in = new CryptoReadFeature(session, new DAVReadFeature(session), cryptomator)
                .read(file1, new TransferStatus().length(content.length), new DisabledConnectionCallback());
        new StreamCopier(new TransferStatus(), new TransferStatus()).transfer(in, buffer);
        assertArrayEquals(content, buffer.toByteArray());
    }
    new CryptoDeleteFeature(session, new DAVDeleteFeature(session), cryptomator).delete(
            Arrays.asList(file1, file2, dir1, vault), new DisabledLoginCallback(),
            new Delete.DisabledCallback());
    localFile1.delete();
    localFile2.delete();
    localDirectory1.delete();
}

From source file:io.syndesis.github.GitHubServiceITCase.java

@Before
public void before() {

    authToken = System.getProperties().getProperty("github.oauth.token");

    Assume.assumeNotNull(authToken);//from w w w .j a  v a2s. com
    Assume.assumeFalse("GitHub OAuth token needs to be specified in Java system property `github.oauth.token`",
            authToken.isEmpty());

    client = new KeycloakProviderTokenAwareGitHubClient();

    // Now that we have a client we create one of our GitHubService
    githubService = new GitHubServiceImpl(new RepositoryService(client), new UserService(client), gitWorkflow);

    webserver = new DefaultMockServer();
    webserver.start(1234);

    webserver.expect().get().withPath("/auth/realms/syndesis-it/broker/github/token")
            .andReturn(200, "access_token=" + authToken + "&scope=public_repo%2Cuser%3Aemail&token_type=bearer")
            .always();

    KeycloakAuthenticationToken keycloakAuthenticationToken = new KeycloakAuthenticationToken(
            new SimpleKeycloakAccount(
                    new KeycloakPrincipal<RefreshableKeycloakSecurityContext>("testuser", null), null,
                    new RefreshableKeycloakSecurityContext(null, null,
                            "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6MTIzNC9hdXRoL3JlYWxtcy9zeW5kZXNpcy1pdCJ9.N0R7v55eiVXMzzhooYb1BStzyu_iP07wKNIO9z9dRMs",
                            null, null, null, null)));

    SecurityContextHolder.getContext().setAuthentication(keycloakAuthenticationToken);
}

From source file:io.wcm.config.core.override.impl.SystemPropertyOverrideProvider.java

@Activate
void activate(final ComponentContext ctx) {
    Dictionary config = ctx.getProperties();
    final boolean enabled = PropertiesUtil.toBoolean(config.get(PROPERTY_ENABLED), DEFAULT_ENABLED);

    Map<String, String> map = new HashMap<>();
    if (enabled) {
        Properties properties = System.getProperties();
        Enumeration<Object> keys = properties.keys();
        while (keys.hasMoreElements()) {
            Object keyObject = keys.nextElement();
            if (keyObject instanceof String) {
                String key = (String) keyObject;
                if (StringUtils.startsWith(key, SYSTEM_PROPERTY_PREFIX)) {
                    map.put(StringUtils.substringAfter(key, SYSTEM_PROPERTY_PREFIX), System.getProperty(key));
                }/*from  ww  w  . ja va2 s  .  com*/
            }
        }
    }
    this.overrideMap = ImmutableMap.copyOf(map);
}