Encrypted password for "cuba.web.ldap.password"

Hello,

is there a way to specify the password for the app setting “cuba.web.ldap.password” in encrypted form instead of plain text?

Greetings
Andreas

Hi Andreas,

CUBA does not provide any built-in features for working with encrypted properties. However, you can easily modify the property value on application start:

@EventListener
public void applicationContextInitialized(AppContextInitializedEvent event) {
    String encryptedProperty = AppContext.getProperty("cuba.web.ldap.password");
    AppContext.setProperty("cuba.web.ldap.password", decrypt(encryptedProperty));
}

Also, consider providing the property value as an OS environment variable (see the docs), maybe then you won’t need the encryption.