You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Michael Rambichler <mi...@rambichler.at> on 2021/04/21 14:35:03 UTC

Jasypt and PropertySource

Dear Community,

Do I miss something or is it not implemented?
I am working with Jasypt Config Encryption. (org.apache.camel.springboot:
camel-jasypt-starter)

Everything works fine if a access the property via:
     @Value("${com.spar-ics.eai.routes.hello.hiddenPassword}")
    private String encryptedPassword;

But via @ConfigurationProperties the value is not encrypted.

I would appreciate any help

Best
 Michael


/**
 * Configuration class for Route dataformat-free
 */
@NoArgsConstructor
@Getter
@Setter
@Configuration
@ConfigurationProperties(prefix ="com.eai.routes.hello")
public class HelloConfig extends RouteConfig {
    private String hiddenPassword;
}


@Component
public class HelloSecureRoute extends RouteBuilder {

    // this works fine
    @Value("${com.spar-ics.eai.routes.hello.hiddenPassword}")
    private String encryptedPassword;

    @Autowired
    HelloConfig routeConfig;

    @Override
    public void configure() throws Exception {

        from("file://data?noop=true")
                .process(exchange -> {
                    LOG.info("Password encrypted:{}", encryptedPassword)
                    LOG.info("Password not encrypted HelloConfig:{}",
routeConfig.getHiddenPassword());
                }
                .log("${body}");
    }

Re: Jasypt and PropertySource

Posted by Michael Rambichler <mi...@rambichler.at>.
Hi, no this was just a typo in this example.
In "real world" this is correct.

In the meantime I switched to the
com.github.ulisesbocchio:jasypt-spring-boot-starter and inject the
encryptor via a bean. This works. But i think there is a bug in
the camel-jasypt-starter

Am Mi., 21. Apr. 2021 um 20:02 Uhr schrieb bukaj_s <js...@gmail.com>:

> spar-ics?
>
> On Wed, 21 Apr 2021, 16:35 Michael Rambichler, <mi...@rambichler.at>
> wrote:
>
> > Dear Community,
> >
> > Do I miss something or is it not implemented?
> > I am working with Jasypt Config Encryption. (org.apache.camel.springboot:
> > camel-jasypt-starter)
> >
> > Everything works fine if a access the property via:
> >      @Value("${com.spar-ics.eai.routes.hello.hiddenPassword}")
> >     private String encryptedPassword;
> >
> > But via @ConfigurationProperties the value is not encrypted.
> >
> > I would appreciate any help
> >
> > Best
> >  Michael
> >
> >
> > /**
> >  * Configuration class for Route dataformat-free
> >  */
> > @NoArgsConstructor
> > @Getter
> > @Setter
> > @Configuration
> > @ConfigurationProperties(prefix ="com.eai.routes.hello")
> > public class HelloConfig extends RouteConfig {
> >     private String hiddenPassword;
> > }
> >
> >
> > @Component
> > public class HelloSecureRoute extends RouteBuilder {
> >
> >     // this works fine
> >     @Value("${com.spar-ics.eai.routes.hello.hiddenPassword}")
> >     private String encryptedPassword;
> >
> >     @Autowired
> >     HelloConfig routeConfig;
> >
> >     @Override
> >     public void configure() throws Exception {
> >
> >         from("file://data?noop=true")
> >                 .process(exchange -> {
> >                     LOG.info("Password encrypted:{}", encryptedPassword)
> >                     LOG.info("Password not encrypted HelloConfig:{}",
> > routeConfig.getHiddenPassword());
> >                 }
> >                 .log("${body}");
> >     }
> >
>

Re: Jasypt and PropertySource

Posted by bukaj_s <js...@gmail.com>.
spar-ics?

On Wed, 21 Apr 2021, 16:35 Michael Rambichler, <mi...@rambichler.at>
wrote:

> Dear Community,
>
> Do I miss something or is it not implemented?
> I am working with Jasypt Config Encryption. (org.apache.camel.springboot:
> camel-jasypt-starter)
>
> Everything works fine if a access the property via:
>      @Value("${com.spar-ics.eai.routes.hello.hiddenPassword}")
>     private String encryptedPassword;
>
> But via @ConfigurationProperties the value is not encrypted.
>
> I would appreciate any help
>
> Best
>  Michael
>
>
> /**
>  * Configuration class for Route dataformat-free
>  */
> @NoArgsConstructor
> @Getter
> @Setter
> @Configuration
> @ConfigurationProperties(prefix ="com.eai.routes.hello")
> public class HelloConfig extends RouteConfig {
>     private String hiddenPassword;
> }
>
>
> @Component
> public class HelloSecureRoute extends RouteBuilder {
>
>     // this works fine
>     @Value("${com.spar-ics.eai.routes.hello.hiddenPassword}")
>     private String encryptedPassword;
>
>     @Autowired
>     HelloConfig routeConfig;
>
>     @Override
>     public void configure() throws Exception {
>
>         from("file://data?noop=true")
>                 .process(exchange -> {
>                     LOG.info("Password encrypted:{}", encryptedPassword)
>                     LOG.info("Password not encrypted HelloConfig:{}",
> routeConfig.getHiddenPassword());
>                 }
>                 .log("${body}");
>     }
>