If the directory/file paths specified in this guide do not exist in your WSO2 product, see Directory Structure of WSO2 Products to locate the paths applicable to your product.
Page Comparison - Carbon Secure Vault Implementation (v.10 vs v.11) - Administration Guide 4.4.x - WSO2 Documentation

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Write a Secret Callback class. You need to implement the SecretCallbackHandler interface or extend the AbstractSecretCallbackHandler abstract class. For example,

    Code Block
    Java
    Java
    public class HardCodedSecretCallbackHandler extends AbstractSecretCallbackHandler {
         protected void handleSingleSecretCallback(SingleSecretCallback singleSecretCallback) {
                singleSecretCallback.setSecret("password");
         }
    }
  2. We can set multiple password-based as follows:

    Code Block
    public class HardCodedSecretCallbackHandler extends AbstractSecretCallbackHandler {
        protected void handleSingleSecretCallback(SingleSecretCallback singleSecretCallback) {
             if("foo".equals(singleSecretCallback.getId())){
                singleSecretCallback.setSecret("foo_password");
             } else if("bar".equals(singleSecretCallback.getId())){
                singleSecretCallback.setSecret("bar_password");
               }
       }
    }
  3. Create a JAR or an OSGI bundle and copy the JAR file to the <PRODUCT_HOME>/repository/component/lib/ directory or the OSGI bundle to the <PRODUCT_HOME>/repository/component/dropins/ directory
  4. Configure the master-datasources.xml file with an alias name and your Secret Callback handler class name. For example,

    Code Block
    XML
    XML
    <datasource>
                <name>WSO2_CARBON_DB</name>
                <description>The datasource used for registry and user manager</description>
                <jndiConfig>
                    <name>jdbc/WSO2CarbonDB</name>
                </jndiConfig>
                <definition type="RDBMS">
                    <configuration>
     <url>jdbc:h2:repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000</url>
                        <username>wso2carbon</username>
                        <passwordsvns<password svns:secretAlias="Datasources.WSO2_CARBON_DB.Configuration.Password">password</password>
                        <driverClassName>org.h2.Driver</driverClassName>
                        <maxActive>50</maxActive>
                        <maxWait>60000</maxWait>
                        <testOnBorrow>true</testOnBorrow>
                        <validationQuery>SELECT 1</validationQuery>
                        <validationInterval>30000</validationInterval>
                    </configuration>
                </definition>
            </datasource>

     Also, replace the secret callback handler class name in <PRODUCT_HOME>/repository/conf/security/secret-conf.properties file with your Secret Callback handler class name.

  5. Restart the server.

...