Search code examples
javaapache-cameljbossfuse

How to encrypt/decrypt passwords in blueprint.xml?


I want to set user name & password for RedHat AMQ. As password could not be plain text, want to specify in encrypted way.

<bean class="org.apache.activemq.camel.component.ActiveMQComponent" id="activemq">
        <property name="brokerURL" value="${activemq.brokerURL}"/>
        <property name="userName" value="${activemq.userName}"/>
        <property name="password" value="${activemq.password}"/>
    </bean>
activemq.userName=jboss
activemq.password=ENC(kOPUJKK141oluf4XZC91iw==)

Solution

  • You can achieve this by adding Jasypt dependency in pom.xml file such as-

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-jasypt</artifactId>
        <version>x.x.x</version> <!-- use the same version as your Camel core version -->
    </dependency>
    

    It encode the values in property file such as .CFG file and decode the same whenever using inside the project at runtime. The detail of this is available at link.