Store files without using FileDocuments

0
To use the Kafka Module with SSL security, I have to configure the location of the key store. The easiest solution is to add the key store in the Resources folder when creating a deployment package. However, I want to manage these key stores at run time. Therefore, I am looking for a way to save a file to a specific location. I have considered the following approaches: Writing files to the Resources folder works, but only temporarily: on application restart, the key store is removed. Write files to the Temporary folder, but they are not temporary, and how the clean up of this folder is done is unclear. Reverse engineer the location of the file which is stored with the FileDocument interface, but this does not seem like a stable solution as Mendix could change its implementation.   This leads to the question in the topic: where can I (persistently) store files without using the FileDocument interface?
asked
1 answers
0

To expand on Ronald's answer: the SAML module tries to use the JVM keystore. The CredentialRepository class from package saml20.implementation.security contains the following code:

 

    private static KeyStore loadJVMKeyStore() throws KeyStoreException,
            NoSuchAlgorithmException, CertificateException,
            FileNotFoundException, IOException {
        KeyStore keyStore = KeyStore.getInstance("JKS");

        String keyStoreResource = System.getProperty("javax.net.ssl.keyStore");

        if (keyStoreResource != null) {
            // applicable if certificates have been manually added to the server
            // (e.g. in the Mx modeler or in the cloud)
            File keyStoreFile = new File(keyStoreResource);

            if (jvmKeyStorePW == null) {
                jvmKeyStorePW = System.getProperty("javax.net.ssl.keyStorePassword");
            }

            keyStore.load(new FileInputStream(keyStoreFile),
                    jvmKeyStorePW.toCharArray());
        } else {
            // create a new store when no certificates have been manually added
            // to the server
            if (jvmKeyStorePW == null) {
                jvmKeyStorePW = saml20.proxies.constants.Constants.getKeystorePassword();
            }
            keyStore.load(null, jvmKeyStorePW.toCharArray());
        }
        return keyStore;
    }

 

answered