Jasypt - Encrypted user name / password not available outside route or inside processor

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Jasypt - Encrypted user name / password not available outside route or inside processor

atg roxx
Hi Team,

I am trying to use Jasypt for encryption or userid/password used to connect
to 3rd party services.

But While doing so I notice that the encrypted userid/pwd are available
only  inside the route definitiion

i.e:

@Override
public void configure() throws Exception {

                log.info("Configuring routes. Route queue name is  " +
{{test.queue}} );                            ------(1)

                  from("{{test.queue}}")

       ----(2)
.log(" queue name is "+"{{test.queue}}" )
                                             ----(3)
.choice()
.when(header(Constants.SERVICENAME).isEqualTo(PafConstants.PAFLOOKUP))
.to("direct:{{test.paflookup}")
                                         ----(4)
.otherwise()
.log("error");
    from("direct:{{ test.paflookup }")
                                                                 ----(5)
.log("passwed is "+"{{cool.password}}")
                                             ----(6)

 .process(new
PafLookupServiceRequestProcessor("{{dss.paf.queue}}",password,serviceURL,serialNo))
                   ----(7)
                        .log("Finished processing
"+PafConstants.PAFLOOKUP+Constants.LOG_CORRELATIONID);

}


The problem is that I can get the values : {{test.queue}} and
 {{test.paflookup}}  and {{cool.password}}  at line 2, 3, 4, 5 and 6.
But I am not able to get the values of this variable  at point 1 and 7. i.e
outside the route and processor .


Could anyone help me in this. I have to pass the encrypted value in side
the processor ( point 7) .



-Thanks in advance.
atgroxx.
Reply | Threaded
Open this post in threaded view
|

Re: Jasypt - Encrypted user name / password not available outside route or inside processor

Claus Ibsen-2
Hi

At point (1) you use the logger of the class, which is just a regular
logger. It just logs what ever you type in the String.

When you use the Camel Java DSL to define routes, eg in the
configure() method and you use the Camel API for that.
Then there is a .log which is the Log EIP
http://camel.apache.org/logeip.html

The Camel DSL supports the {{ }} property placeholders, and therefore
it works in (2) to (6) as thats the DSL using it.

To use it outside the DSL you essentially have to use the PropertiesComponent.
However we have a method on CamelContext that makes this easier
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html#resolvePropertyPlaceholders(java.lang.String)

Just use the resolvePropertyPlaceholders method from CamelContext.

There should be a getContext() method to get access to the CamelContext.


On Tue, May 8, 2012 at 12:18 PM, atg roxx <[hidden email]> wrote:

> Hi Team,
>
> I am trying to use Jasypt for encryption or userid/password used to connect
> to 3rd party services.
>
> But While doing so I notice that the encrypted userid/pwd are available
> only  inside the route definitiion
>
> i.e:
>
> @Override
> public void configure() throws Exception {
>
>                log.info("Configuring routes. Route queue name is  " +
> {{test.queue}} );                            ------(1)
>
>                  from("{{test.queue}}")
>
>       ----(2)
> .log(" queue name is "+"{{test.queue}}" )
>                                             ----(3)
> .choice()
> .when(header(Constants.SERVICENAME).isEqualTo(PafConstants.PAFLOOKUP))
> .to("direct:{{test.paflookup}")
>                                         ----(4)
> .otherwise()
> .log("error");
>    from("direct:{{ test.paflookup }")
>                                                                 ----(5)
> .log("passwed is "+"{{cool.password}}")
>                                             ----(6)
>
>  .process(new
> PafLookupServiceRequestProcessor("{{dss.paf.queue}}",password,serviceURL,serialNo))
>                   ----(7)
>                        .log("Finished processing
> "+PafConstants.PAFLOOKUP+Constants.LOG_CORRELATIONID);
>
> }
>
>
> The problem is that I can get the values : {{test.queue}} and
>  {{test.paflookup}}  and {{cool.password}}  at line 2, 3, 4, 5 and 6.
> But I am not able to get the values of this variable  at point 1 and 7. i.e
> outside the route and processor .
>
>
> Could anyone help me in this. I have to pass the encrypted value in side
> the processor ( point 7) .
>
>
>
> -Thanks in advance.
> atgroxx.



--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/