[ https://issues.apache.org/jira/browse/ARIES-1655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15830026#comment-15830026 ]
Paolo Antinori commented on ARIES-1655: --------------------------------------- I'm starting to suspect the issue is within Camel. The following example: {code:xml} <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0" xmlns:enc="http://karaf.apache.org/xmlns/jasypt/v1.0.0" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"> <cm:property-placeholder persistent-id="mytest" update-strategy="reload" > <cm:default-properties> <cm:property name="token" value="ENC(5f85Rg1mhRZkAwPiRK3H+w==)"/> </cm:default-properties> </cm:property-placeholder> <enc:property-placeholder> <enc:encryptor class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor"> <property name="config"> <bean class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig"> <property name="algorithm" value="PBEWithMD5AndDES" /> <property name="password" value="password" /> </bean> </property> </enc:encryptor> </enc:property-placeholder> <!-- this works in Karaf with the following command: config:propset - -pid mytest token 'ENC(VJ84f42Ynb7NGTZ9+n8V9D5jHIT3ky+ugp88q/DG/z3f+ttRofRHtg==)' --> <bean id="anyString" class="java.lang.String" factory-method="valueOf"> <argument value="############# ${token} #############"/> </bean> <camelContext id="blueprintContext" trace="false" xmlns="http://camel.apache.org/schema/blueprint"> <route> <from uri="timer:foo?fixedRate=true&period=1000" /> <bean ref="anyString" method="toString" /> <log message="Outside of Camel Context ${body}" /> </route> <route> <from uri="timer:foo?fixedRate=true&period=1000" /> <setBody> <simple>{{token}}</simple> </setBody> <log message="Outside of Camel Context ${body}" /> </route> </camelContext> </blueprint> {code} when used in combination with {code} config:propset --pid mytest token 'ENC(VJ84f42Ynb7NGTZ9+n8V9D5jHIT3ky+ugp88q/DG/z3f+ttRofRHtg==)' {code} generates the follwoing output {code} 15:24:34,680 | INFO | rint Extender: 2 | BlueprintCamelContext | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | Apache Camel 2.17.0.redhat-630187 (CamelContext: blueprintContext) started in 0.073 seconds 15:24:35,681 | INFO | 22 - timer://foo | route17 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | Outside of Camel Context ############# __WRITTEN VIA CONFIG ADMIN__ ############# 15:24:35,681 | INFO | 22 - timer://foo | route18 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | Outside of Camel Context ENC(VJ84f42Ynb7NGTZ9+n8V9D5jHIT3ky+ugp88q/DG/z3f+ttRofRHtg==) {code} Showing that a {{[bean]}} node defined in xml file is able to consume the resolved token, while Camel integration fails to do so. > Placeholders in XML - issue with enc: , cm: and ConfigAdmin updates > ------------------------------------------------------------------- > > Key: ARIES-1655 > URL: https://issues.apache.org/jira/browse/ARIES-1655 > Project: Aries > Issue Type: Bug > Components: Blueprint > Reporter: Paolo Antinori > > It seems there is an issue with token replacement when both {{cm:}} and > {{enc:}} namespaces are involved: > Full reproducer inline since is short enough: > {code:xml} > <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" > > xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" > xmlns:enc="http://karaf.apache.org/xmlns/jasypt/v1.0.0"> > > <enc:property-placeholder> > <enc:encryptor > class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor"> > <property name="config"> > <bean > class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig"> > <property name="algorithm" value="PBEWithMD5AndDES"/> > <property name="password" value="ENCRYPTION_PASSWORD"/> > </bean> > </property> > </enc:encryptor> > </enc:property-placeholder> > <cm:property-placeholder persistent-id="mytest" update-strategy="reload"> > <cm:default-properties> > <!-- <cm:property name="mykey" value="5f85Rg1mhRZkAwPiRK3H+w=="/> > --> > <!-- <cm:property name="token" value="ENC(${mykey})"/> --> > <cm:property name="token" value="ENC(5f85Rg1mhRZkAwPiRK3H+w==)"/> > </cm:default-properties> > </cm:property-placeholder> > <camelContext id="blueprintContext" trace="false" > xmlns="http://camel.apache.org/schema/blueprint"> > <route> > <from uri="timer:foo?fixedRate=true&period=1000" /> > <setBody><simple>{{token}}</simple> > </setBody> > <log message="Outside of Camel Context ${body}" /> > </route> > </camelContext> > > </blueprint> > {code} > If the above blueprint file is deployed, it works as expected: camel is able > to log lines containing the decrypted value of the encoded token. > But > if the value is changed at {{ConfigAdmin}} level, in Karaf with this command: > {code} > config:propset --pid mytest token 'ENC(5f85Rg1mhRZkAwPiRK3H+w==)' > {code} > The token is no longer unencrypted: > {code} > 2017-01-09 15:07:24,666 | INFO | #2 - timer://foo | route2 > | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | Outside > of Camel Context ENC(5f85Rg1mhRZkAwPiRK3H+w==) > {code} > I have tried adding indirection, with the lines you can see commented out but > I have not been able to make it work. > I have worked around the issue writing an implementation of > {{org.osgi.service.cm.ConfigurationPlugin}} that gave me the functionality I > needed but I wonder if this should just work out of the box: > https://github.com/paoloantinori/fabric8/commit/88159db9957cd85e773c807c63bf737be6dc8d81 -- This message was sent by Atlassian JIRA (v6.3.4#6332)