2014-07-18 4 views
1

다음과 같이 낙타 컨텍스트 외부의 낙타 청사진에서 JASYPT를 사용하여 속성을 해독하려고합니다. 낙타 컨텍스트 외부에서 JASYPT + Property Component를 사용할 수 있습니까? 사용자 이름 [SMX] 또는 암호가 잘못되었습니다낙타 컨텍스트 외부에서 JASYPT 사용

나는

그것은 ava.lang.SecurityException가

오류 다음 날주고있다

<?xml version="1.0" encoding="UTF-8"?> 
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0" 
     xsi:schemaLocation=" 
     http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> 

    <cm:property-placeholder id="prop" persistent-id="mypersistent"> 
    <!-- list some properties for this test --> 
    <cm:default-properties> 
     <cm:property name="cool.result" value="ENC(jU1ypXF709gpmOsJ2nKGgTbtd3oAs0n3rUNxEmMp2G8=)"/> 
     <cm:property name="jms.password" value="ENC(QhKlLI3eMKUhsUSPEWIRFw==)"/> 
    </cm:default-properties> 
    </cm:property-placeholder> 
    <bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent"> 
    <property name="location" value="blueprint:prop"/> 
    <property name="propertiesParser" ref="jasypt"></property> 
</bean> 
<!-- define the jasypt properties parser with the given password to be used --> 
<bean id="jasypt" class="org.apache.camel.component.jasypt.JasyptPropertiesParser"> 
    <property name="password" value="secret"/> 
</bean> 
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent"> 
    <property name="connectionFactory"> 
     <bean class="org.apache.activemq.ActiveMQConnectionFactory"> 
      <property name="brokerURL" value="tcp://127.0.0.1:61616" /> 
      <property name="userName" value="smx"/> 
      <property name="password" value="${jms.password}"/> 
     </bean> 
    </property> 
</bean> 
<camelContext xmlns="http://camel.apache.org/schema/blueprint"> 
    <!-- define the camel properties placeholder, and let it leverage jasypt --> 
    <!--<propertyPlaceholder id="properties" 
         location="blueprint:prop" 
         propertiesParserRef="jasypt"/>--> 
    <route> 
     <from uri="file://inputfolder"/> 
     <log message="jms password {{jms.password}}"/> 
     <setBody><constant>Foo message</constant></setBody> 
     <to uri="jms:queue:default.inputchannel?jmsMessageType=Text&amp;transferExchange=true"/> 
     <to uri="{{cool.result}}"/> 
    </route> 
</camelContext> 

servciemix 5.0.0을 사용하고 있습니다. at org.apache.activemq.security.JaasAuthenticationBroker.addConnection (JaasAuthenticationBroker.java:80) [84 : org.apache.activemq.activemq-osgi : 5.9.0] at org.apache.activemq.broker.MutableBrokerFilter.addConnection (MutableBrokerFilter.java:97)[84:org.apache.activemq.activemq-osgi:5.9.0] at org.apache.activemq.broker.TransportConnection.processAddConnection (TransportConnection.java:733) [84 : org.apache .activemq.activemq-osgi : 5.9.0] at org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConnection (ManagedTransportConnection.java:79) [84 : org.apache.activemq.activemq-osgi : 5.9.0] at org.apache.activemq.command.ConnectionInfo.visit (ConnectionInfo.java:139) [84 : org.apache.activemq.activemq-osgi : 5.9.0] at org.apache.activemq.broker.TransportConnection.service (TransportConnection.java:292) [ 84 : org.apache.activemq.activemq-osgi : 5.9.0] at org.apache.activemq.broker.TransportConnection $ 1.onCommand (TransportConnection.java:149) [84 : org.apache.activemq.activemq-osgi : 5.9.0] at org.apache.activemq.transport.MutexTransport.onCommand (MutexTransport.java:50) [84 : org.apache.activemq.activemq-osgi : 5.9.0] at org.apache.activemq.transport .WireFormatNegotiator.onCommand (WireFormatNegotiator.java:113) [84 : org.apache.activemq.activemq-osgi : 5.9.0] at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand (AbstractInactivityMonitor.java:270) [84 : org.apache.activemq.activemq-osgi : 5.9.0] at org.apache.activemq.transport.TransportSupport.doConsume (TransportSupport.java:83) [84 : org.apache.activemq.activemq-osgi : 5.9. 0] at org.apache.activemq.transport.tcp.TcpTransport.doRun (TcpTransport.java:214) (84 : org.apache.activemq-osgi : 5.9.0) OSGI : java.lang.Thread.run (Thread.java:745)에서 5.9.0] [: 1.7.0_60]

+0

로그는 올바르게 인쇄되고 있습니다. 내부 컨텍스트에서 잘 작동합니다. – Arpit

답변

1

당신은 아파치 낙타 외부 org.apache.camel.component.jasypt.JasyptPropertiesParser을 사용할 수 없습니다, 또는 <camelContext>.

<bean>의 경우 속성을 설정하는 청사진 propertyplaceholder입니다. 그래서 당신은 예를 들어,이 물건

<cm:property-placeholder id="prop" persistent-id="mypersistent"> 
+0

감사합니다. 청사진 속성 자리 표시자를 조사합니다. – Arpit

0

처럼 입센 청사진 속성 자리에보고 할 필요가 말했다, OSGI 청사진 속성 자리에 jasypt에 훅 할 수있는 방법이 필요합니다. 위에서 언급 한 문제를 해결하는 작업 청사진은 다음과 같습니다.

<?xml version="1.0" encoding="UTF-8"?> 
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/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" 
     xsi:schemaLocation=" 
     http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> 
<ext:property-placeholder id="prop"> 
    <!-- list some properties for this test --> 
    <ext:default-properties> 
     <ext:property name="cool.result" value="ENC(jU1ypXF709gpmOsJ2nKGgTbtd3oAs0n3rUNxEmMp2G8=)"/> 
     <ext:property name="jms.password" value="ENC(QhKlLI3eMKUhsUSPEWIRFw==)"/> 
    </ext:default-properties> 
</ext: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="passwordEnvName" value="CAMEL_ENCRYPTION_PASSWORD" /> 
    </bean> 
    </property> 
</enc:encryptor> 
</enc:property-placeholder> 
    <bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent"> 
    <property name="location" value="blueprint:prop"/> 
    <property name="propertiesParser" ref="jasypt"></property> 
</bean> 
<!-- define the jasypt properties parser with the given password to be used --> 
<bean id="jasypt" class="org.apache.camel.component.jasypt.JasyptPropertiesParser"> 
    <property name="password" value="secret"/> 
</bean> 
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent"> 
    <property name="connectionFactory"> 
     <bean class="org.apache.activemq.ActiveMQConnectionFactory"> 
      <property name="brokerURL" value="tcp://127.0.0.1:61616" /> 
      <property name="userName" value="smx"/> 
      <property name="password" value="${jms.password}"/> 
     </bean> 
    </property> 
</bean> 
<camelContext xmlns="http://camel.apache.org/schema/blueprint"> 
    <!-- define the camel properties placeholder, and let it leverage jasypt --> 
    <!--<propertyPlaceholder id="properties" 
         location="blueprint:prop" 
         propertiesParserRef="jasypt"/>--> 
    <route> 
     <from uri="file://inputfolder"/> 
     <log message="jms password {{jms.password}}"/> 
     <setBody><constant>Foo message</constant></setBody> 
     <to uri="jms:queue:default.inputchannel?jmsMessageType=Text&amp;transferExchange=true"/> 
     <to uri="{{cool.result}}"/> 
    </route> 
</camelContext> 
</blueprint> 
관련 문제