RE: Redacting db user name and password from XML

2018-07-18 Thread Meeks, Andrew
debugging to see if there is a different piece of logic causing things other than url and driver to be ignored. -Original Message- From: John Huss Sent: Wednesday, July 18, 2018 2:33 PM To: user@cayenne.apache.org Subject: Re: Redacting db user name and password from XML On Wed, Jul 18

Re: Redacting db user name and password from XML

2018-07-18 Thread John Huss
getting passed through. Obviously application.properties would > contain variables that are known to be the same in different profiles, your > situation may vary and some may need to go in to > application-PROFILE.properties or vice-versa. > > I hope that is useful to someone,

RE: Redacting db user name and password from XML

2018-07-18 Thread Meeks, Andrew
to be the same in different profiles, your situation may vary and some may need to go in to application-PROFILE.properties or vice-versa. I hope that is useful to someone, Andrew -Original Message- From: Pascal Robert Sent: Friday, January 19, 2018 10:01 AM To: user@cayenne.apache.org

Re: Redacting db user name and password from XML

2018-01-19 Thread Pascal Robert
I confirm this behaviour, and I switched back to XMLPoolingDataSourceFactory. > Le 18 janv. 2018 à 03:59, Andrus Adamchik a écrit : > > Ah, mystery solved. Looking at the code, more specifically to use properties > for a given DataSource Cayenne would expect you to specify at least DB URL > an

Re: Redacting db user name and password from XML

2018-01-18 Thread Andrus Adamchik
Ah, mystery solved. Looking at the code, more specifically to use properties for a given DataSource Cayenne would expect you to specify at least DB URL and DB driver. Username/password are optional. Andrus > On Jan 18, 2018, at 11:46 AM, Nikita Timofeev > wrote: > > Hi all, > > Made some r

Re: Redacting db user name and password from XML

2018-01-18 Thread Nikita Timofeev
Hi all, Made some research, and here is what I've found. Cayenne do switch to System properties (defined via -D or with DI binding) automatically but it do so only when all properties are defined. So this code will work as expected, and use overridden DataSource properties: ServerRuntime cayenn

Re: Redacting db user name and password from XML

2018-01-17 Thread Andrus Adamchik
> On Jan 17, 2018, at 11:05 PM, Pascal Robert wrote: > > Ahhh… If I change the factory in the node definition to > org.apache.cayenne.configuration.server.PropertyDataSourceFactory, it does > read the command-line properties. That should sorta happen automatically. We are still looking why i

Re: Redacting db user name and password from XML

2018-01-17 Thread Pascal Robert
Ahhh… If I change the factory in the node definition to org.apache.cayenne.configuration.server.PropertyDataSourceFactory, it does read the command-line properties. > Le 17 janv. 2018 à 13:37, Mark Hull a écrit : > > Just to chime in on this topic, since my original question about > user/pass

Re: Redacting db user name and password from XML

2018-01-17 Thread Mark Hull
/Errata:/ In my previous email I included an outdated XML node description. My apologies. It should be:      factory="com.hulles.a1icia.cayenne.A1iciaDataSourceFactory" parameters="hint"   schema-update-strategy="org.apache.cayenne.access.dbsync.SkipSchemaUpdateStrategy">             The pa

Re: Redacting db user name and password from XML

2018-01-17 Thread Mark Hull
Just to chime in on this topic, since my original question about user/password redaction I have done a lot of research and testing, and I decided to go with a modified version of Mike Kienenberger's DataSourceFactory. I also have a just plain Java application, btw. Since my needs were a bit dif

Re: Redacting db user name and password from XML

2018-01-17 Thread Andrus Adamchik
Researching now... One possible difference in my code may be that I don't even model a DataNode in the Modeler. It is added as a DataSource in runtime. So a bug may have crept in for the other scenario. Andrus > On Jan 17, 2018, at 3:57 PM, Amedeo Mantica wrote: > > I tried setting connection

Re: Redacting db user name and password from XML

2018-01-17 Thread Amedeo Mantica
I tried setting connection dictionary programmactically too, I was succesful, but only after deletion of the existing connection discionary from the xml In my module: String driver = conf.getString(JDBC_DRIVER_PROPERTY); String jdbcUrl = conf.getString(JDBC_URL_PROPERTY); String username = conf.

Re: Redacting db user name and password from XML

2018-01-17 Thread Pascal Robert
It’s not a Bootique project, it’s a plain old Java project that I run in Eclipse. I can read the properties with System.getProperty, but Cayenne is still using the user and password from the model. INFO [main] (XMLDataChannelDescriptorLoader.java:125) - Loading XML configuration resource from

Re: Redacting db user name and password from XML

2018-01-16 Thread Andrus Adamchik
If it is not a Bootique project, the property should work. A few non-Bootique projects that I still have (that are on Cayenne 4.0) are started using -Dcayenne.* properties from the docs. If it is a Bootique project, you will need to use the Bootique approach to configure credentials for anythin

Re: Redacting db user name and password from XML

2018-01-16 Thread Pascal Robert
Do -Dcayenne.jdbc.username really work? I’m trying to use that (so that the password is not stored in Git), and the runtime is still using the login information from the XML file. Cayenne 4.1.M1. ServerRuntime mysqlRuntime = ServerRuntime.builder().addConfig("cayenne-mysql.xml").build(); > Le

Re: Redacting db user name and password from XML

2017-12-19 Thread Andrus Adamchik
Sorry. You are right. Of course the shell will resolve the vars and put the values in the process name. Been living in Bootique world for the last 2 years, so I thought of a different scenario of the env var being read not via System.getProperty(), but rather via System.getenv(). So yeah, "-D"

Re: Redacting db user name and password from XML

2017-12-18 Thread Musall, Maik
> Am 19.12.2017 um 06:56 schrieb Andrus Adamchik : > >> A disadvantage of this approach, though, is it puts the username/password >> on the command-line and/or the process list, plus potentially exposes it in >> command-line history, too. > > It doesn't if you are careful. Nothing prevents you f

Re: Redacting db user name and password from XML

2017-12-18 Thread Andrus Adamchik
> A disadvantage of this approach, though, is it puts the username/password > on the command-line and/or the process list, plus potentially exposes it in > command-line history, too. It doesn't if you are careful. Nothing prevents you from putting these in a startup script of your app (this is wh

Re: Redacting db user name and password from XML

2017-12-18 Thread Mark Hull
I concur. The Java runtime parameter approach will keep the data out of the source code, which helps a lot because I can secure the runtime environment, but the second option in Andrus' StackOverflow link

Re: Redacting db user name and password from XML

2017-12-18 Thread Michael Gentry
A disadvantage of this approach, though, is it puts the username/password on the command-line and/or the process list, plus potentially exposes it in command-line history, too. mrg On Mon, Dec 18, 2017 at 11:49 AM, Andrus Adamchik wrote: > Hi Mark, > > We've done quite a bit of work in Cayenne

Re: Redacting db user name and password from XML

2017-12-18 Thread Mark Hull
Great, I knew you had to have something like this. I had encountered these configuration properties before in my research but I didn't quite realize they could be used as Java runtime properties. These will work quite well, I think. Is there a standard way to use them in the Modeler, so they do

Re: Redacting db user name and password from XML

2017-12-18 Thread Andrus Adamchik
Hi Mark, We've done quite a bit of work in Cayenne to avoid complex things like PasswordEncoding or custom DataSourceFactories. If all that is needed is to change / define login credentials, the simplest way is via properties [1]. [2] shows an example with a single DataNode. If you have more th

Re: Redacting db user name and password from XML

2017-12-18 Thread Mike Kienenberger
This is from my Cayenne 3.x project, but it's probably the same for 4.x. Create your own DataSourceFactory class and use it to provide username and password values. == public class ConfigFilePoolingDataSourceFactory implements DataSourceFactory { private static final

Re: Redacting db user name and password from XML

2017-12-18 Thread Mark Hull
Thanks lots for responding. The application, or at least this part of the application, is a classic, plain old Java desktop application. I've used JNDI in the past with Tomcat as you say, and in ancient times I used raw JNDI and MySQL with a desktop application like the one I working on now. Ho

Re: Redacting db user name and password from XML

2017-12-18 Thread Michael Gentry
Hi Mark, What type of application are you developing? For web applications, which I'd imagine are the most common cases, using a JNDI DataSource is the way to go. Your container (Tomcat, Jetty, etc) will provide database connection services to Cayenne through a JNDI lookup. If you aren't develo

Redacting db user name and password from XML

2017-12-16 Thread Mark Hull
I apologize if this question has been asked and answered before but: What is the best-practices solution to redact the database user name and password from an XML file created and used by Cayenne Modeler? The ServerRuntime build statement is simply: cayenneRuntime = ServerRuntime.builder() .ad