Sensitive data in persistence.xml

Asked

Viewed 77 times

1

I am using JPA in my application and so I have a file persistence.xml which contains the connection data to my database:

<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost/banco" />
<property name="javax.persistence.jdbc.user" value="admin" />
<property name="javax.persistence.jdbc.password" value="123456" />
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL9Dialect" />

I wouldn’t like to commit passwords and users in plain text, so I would like to know if anyone knows any ELEGANT alternative to manage the sensitive data of my application, some encryption mechanism, for example.

  • If you are going to use the solution together with a versioning system, I recommend a look at this project, which happens to be from Stackexchange: https://github.com/StackExchange/blackbox

  • If you use a full Javaee Enterprise container configuration and management is in charge of the container, Tomcat is also used JNDI to name these resources

  • 1

    I think JNDI in this case would be ideal for me. I prefer to leave the container (Tomcat) this control of sensitive data. Thanks for the tips! :)

1 answer

1


Solved using JNDI. I prefer to leave this control of sensitive data to the container (Tomcat).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.