ulisesbocchio / jasypt-spring-boot

Jasypt integration for Spring boot
MIT License
2.88k stars 514 forks source link

Problem integrating with an ssl application #1

Closed aruizp closed 9 years ago

aruizp commented 9 years ago

Hi! I used your library to encrypt some properties and it works and the application runs fine. But when I enable SSL in the application it won't work, the application start and all request works, but if i add the HTTPS doesn't return anything. If I remove the @EnableEncryptableProperties from the Application class the SSL works as expected, do you have any clue about whats could be happening? I really appreciate any help.

Greetings!

ulisesbocchio commented 9 years ago

Hi! Do you have sample app where the error is happening? Do you get a any errors? Can you share your SSL config? I'll setup the sample app with an HTTPS sample endpoint to see what happens but I don't know from the top of my head what could be causing the issue. Thanks for using the library! Best, Uli

aruizp commented 9 years ago

We just added this properties, as the spring boot documentation says: server.ssl.key-store = ssl_file.jks server.ssl.key-store-password = asdasd server.ssl.key-password = qwerty Everything works fine with this configuration and SSL is enabled in the right way. If i add the @EnableEncryptableProperties the ssl wont load and the app will work without ssl..

aruizp commented 9 years ago

Just tested with the spring boot sample https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-tomcat-ssl, I added the dependency, the annotation and a password and it fail.

Greetings!

ulisesbocchio commented 9 years ago

Alright let me give that a try and I'll come back to you shortly.

ulisesbocchio commented 9 years ago

Alright, I just did what you suggested and it works. I added an SSL demo project for you to try it out here https://github.com/ulisesbocchio/jasypt-spring-boot/tree/master/jasypt-spring-boot-demo-tomcat-ssl. Keep in mind that during the weekend I added support for multiple PropertySource implementations that may have fixed the issue you were having most likely due to the way the server.ssl.* properties are being retrieved by Spring. Please give it a try with the latest code and let me know if it solves your problem. Best, Uli

aruizp commented 9 years ago

Yeah!, It works now! Thanks! What was the problem? I can see that you add a few more classes. How is that the server.ssl.* props aren't loaded in the same way than the others?

ulisesbocchio commented 9 years ago

Great! Thanks for your feedback. Before I was just wrapping the most basic PropertySource class. But it turns out there are other subclasses such as EnumerablePropertySource and MapPropertySource that need to be wrapped properly also. I also added a proxy mode that uses CGLib proxies to intercept the PropertySource.getProperty(String) method that could be activated with property: jasypt.encryption.proxyPropertySources