You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by lenka <li...@gmail.com> on 2009/10/29 08:45:41 UTC

PasswordSource if passwordLocation is executable

Dear Cayenne users,

I have a problem here. I need to change the password in a runtime.
Therefore I set in Cayenne Modeler: 

in Password Encoder the following values:
Password Location: Executable Program
Password Executable: lenka.Application.test()"

In the xml file, the following code was produced. 

<driver project-version="3.0" class="org.postgresql.Driver">
<url value="jdbc:postgresql://127.0.0.1:5430/databaze_name"/>
<connectionPool min="1" max="1"/>
<login userName="user_name"
encoderClass="org.apache.cayenne.conf.Rot47PasswordEncoder"
passwordLocation="executable"
passwordSource="sk.lenka.Application.test()"/>
</driver>


I wonder what to enter in "passwordSource" if I need to read the
password from the method: lenka.Application.test();


Any help will be appreciated.
Lenka

Re: PasswordSource if passwordLocation is executable

Posted by Michael Gentry <mg...@masslight.net>.
Wouldn't your passwordSource need to look more like:

passwordSource="java -cp PUT_CLASSPATH_HERE com.lenka.Password"

You need to tell Java where to find your class.  For your simple case,
you only need the root directory containing com/lenka/Password.class.

I just made a test case using one of my old models and changed it to
use the executable program option.  It worked.  Here is what the login
portion of my node XML looks like:

	<login userName="techreg" passwordLocation="executable"
passwordSource="java -cp
/Users/mgentry/Documents/workspace/TestLenka/bin com.lenka.Password"/>


mrg

PS. I discovered a bug in doing this.  You can't generate your DB
schema from the modeler when using the executable program option.
I'll file a bug report for this.


On Sat, Oct 31, 2009 at 8:35 AM, lenka <li...@gmail.com> wrote:
> Hello Michael,
>
> hopefully you can help me farther. I did not succeed to run a Java
> method.
>
> I have tried to read the password from the file system, with xml
> something like you wrote, it worked fine. :)
>        <login userName="username" passwordLocation="url"
> passwordSource="file:///home/lenka/password/"/> (where in password is a
> plain text)
>
> However to run a  Java does not work. I have tried with following
> options:
> <login userName="username" passwordLocation="executable"
> passwordSource="com.lenka.Password"/>
> <login userName="username" passwordLocation="executable"
> passwordSource="java com.lenka.Password"/>
> <login userName="username"
> passwordLocation="executable"passwordSource="java
> file://home/lenka/Password"/> (with the absolute address, to
> Password.class)
>
> package com.lenka;
>
> public class Password {
>
>        public static void main(String[] args) {
>                System.out.println("password");
>        }
> }
>
> Any hint will be appreciated.
> Regards
> Lenka
>
> org.apache.cayenne.CayenneRuntimeException: Error detecting database
> type: The server requested password-based authentication, but no
> password was provided.
>
> -----Pôvodná správa-----
> Od: lenka <li...@gmail.com>
> Komu: user@cayenne.apache.org
> Predmet: Re: PasswordSource if passwordLocation is executable
> Dátum: Thu, 29 Oct 2009 16:09:30 +0100
>
> Hi Michael,
>
> Thank you very much for the answer. Yes, I would like to use the Java
> function. But I think I understand it now.
>
> Thank you a lot
> Lenka
>
> -----Original Message-----
> From: Michael Gentry <mg...@masslight.net>
> Reply-to: user@cayenne.apache.org
> To: user@cayenne.apache.org
> Subject: Re: PasswordSource if passwordLocation is executable
> Date: Thu, 29 Oct 2009 09:42:48 -0400
>
>
> Hi Lenka,
>
> The passwordSource in the XML is overloaded in this case and should
> reference the executable to run along with any parameters it needs.
> It looks to me like you are trying to run a Java method?  If so,
> you'll need to have a "java ..." command there.  I also suspect you
> might could use the URL method.  I've used that in the past to read an
> encrypted password off the filesystem.  For that, part of my XML
> looked something like:
>
> <login userName="username" encoderClass="my.TripleDESPasswordEncoder"
> encoderSalt="94VW4MOreXfvbSbB6ewbfp3XkdoZvgwp" passwordLocation="url"
> passwordSource="file:///usr/local/passwords/projectXYZ/password"/>
>
> mrg
>
>
> On Thu, Oct 29, 2009 at 3:45 AM, lenka <li...@gmail.com> wrote:
>>
>> Dear Cayenne users,
>>
>> I have a problem here. I need to change the password in a runtime.
>> Therefore I set in Cayenne Modeler:
>>
>> in Password Encoder the following values:
>> Password Location: Executable Program
>> Password Executable: lenka.Application.test()"
>>
>> In the xml file, the following code was produced.
>>
>> <driver project-version="3.0" class="org.postgresql.Driver">
>> <url value="jdbc:postgresql://127.0.0.1:5430/databaze_name"/>
>> <connectionPool min="1" max="1"/>
>> <login userName="user_name"
>> encoderClass="org.apache.cayenne.conf.Rot47PasswordEncoder"
>> passwordLocation="executable"
>> passwordSource="sk.lenka.Application.test()"/>
>> </driver>
>>
>>
>> I wonder what to enter in "passwordSource" if I need to read the
>> password from the method: lenka.Application.test();
>>
>>
>> Any help will be appreciated.
>> Lenka
>

Re: PasswordSource if passwordLocation is executable

Posted by lenka <li...@gmail.com>.
Hello Michael,

hopefully you can help me farther. I did not succeed to run a Java
method.

I have tried to read the password from the file system, with xml
something like you wrote, it worked fine. :)
	<login userName="username" passwordLocation="url"
passwordSource="file:///home/lenka/password/"/> (where in password is a
plain text)

However to run a  Java does not work. I have tried with following
options:
<login userName="username" passwordLocation="executable"
passwordSource="com.lenka.Password"/>
<login userName="username" passwordLocation="executable"
passwordSource="java com.lenka.Password"/>
<login userName="username"
passwordLocation="executable"passwordSource="java
file://home/lenka/Password"/> (with the absolute address, to
Password.class)

package com.lenka;

public class Password {

	public static void main(String[] args) {
		System.out.println("password");
	}
}

Any hint will be appreciated.
Regards
Lenka

org.apache.cayenne.CayenneRuntimeException: Error detecting database
type: The server requested password-based authentication, but no
password was provided.

-----Pôvodná správa-----
Od: lenka <li...@gmail.com>
Komu: user@cayenne.apache.org
Predmet: Re: PasswordSource if passwordLocation is executable
Dátum: Thu, 29 Oct 2009 16:09:30 +0100

Hi Michael,

Thank you very much for the answer. Yes, I would like to use the Java
function. But I think I understand it now. 

Thank you a lot 
Lenka 

-----Original Message-----
From: Michael Gentry <mg...@masslight.net>
Reply-to: user@cayenne.apache.org
To: user@cayenne.apache.org
Subject: Re: PasswordSource if passwordLocation is executable
Date: Thu, 29 Oct 2009 09:42:48 -0400


Hi Lenka,

The passwordSource in the XML is overloaded in this case and should
reference the executable to run along with any parameters it needs.
It looks to me like you are trying to run a Java method?  If so,
you'll need to have a "java ..." command there.  I also suspect you
might could use the URL method.  I've used that in the past to read an
encrypted password off the filesystem.  For that, part of my XML
looked something like:

<login userName="username" encoderClass="my.TripleDESPasswordEncoder"
encoderSalt="94VW4MOreXfvbSbB6ewbfp3XkdoZvgwp" passwordLocation="url"
passwordSource="file:///usr/local/passwords/projectXYZ/password"/>

mrg


On Thu, Oct 29, 2009 at 3:45 AM, lenka <li...@gmail.com> wrote:
>
> Dear Cayenne users,
>
> I have a problem here. I need to change the password in a runtime.
> Therefore I set in Cayenne Modeler:
>
> in Password Encoder the following values:
> Password Location: Executable Program
> Password Executable: lenka.Application.test()"
>
> In the xml file, the following code was produced.
>
> <driver project-version="3.0" class="org.postgresql.Driver">
> <url value="jdbc:postgresql://127.0.0.1:5430/databaze_name"/>
> <connectionPool min="1" max="1"/>
> <login userName="user_name"
> encoderClass="org.apache.cayenne.conf.Rot47PasswordEncoder"
> passwordLocation="executable"
> passwordSource="sk.lenka.Application.test()"/>
> </driver>
>
>
> I wonder what to enter in "passwordSource" if I need to read the
> password from the method: lenka.Application.test();
>
>
> Any help will be appreciated.
> Lenka

Re: PasswordSource if passwordLocation is executable

Posted by lenka <li...@gmail.com>.
Hi Michael,

Thank you very much for the answer. Yes, I would like to use the Java
function. But I think I understand it now. 

Thank you a lot 
Lenka 

-----Original Message-----
From: Michael Gentry <mg...@masslight.net>
Reply-to: user@cayenne.apache.org
To: user@cayenne.apache.org
Subject: Re: PasswordSource if passwordLocation is executable
Date: Thu, 29 Oct 2009 09:42:48 -0400


Hi Lenka,

The passwordSource in the XML is overloaded in this case and should
reference the executable to run along with any parameters it needs.
It looks to me like you are trying to run a Java method?  If so,
you'll need to have a "java ..." command there.  I also suspect you
might could use the URL method.  I've used that in the past to read an
encrypted password off the filesystem.  For that, part of my XML
looked something like:

<login userName="username" encoderClass="my.TripleDESPasswordEncoder"
encoderSalt="94VW4MOreXfvbSbB6ewbfp3XkdoZvgwp" passwordLocation="url"
passwordSource="file:///usr/local/passwords/projectXYZ/password"/>

mrg


On Thu, Oct 29, 2009 at 3:45 AM, lenka <li...@gmail.com> wrote:
>
> Dear Cayenne users,
>
> I have a problem here. I need to change the password in a runtime.
> Therefore I set in Cayenne Modeler:
>
> in Password Encoder the following values:
> Password Location: Executable Program
> Password Executable: lenka.Application.test()"
>
> In the xml file, the following code was produced.
>
> <driver project-version="3.0" class="org.postgresql.Driver">
> <url value="jdbc:postgresql://127.0.0.1:5430/databaze_name"/>
> <connectionPool min="1" max="1"/>
> <login userName="user_name"
> encoderClass="org.apache.cayenne.conf.Rot47PasswordEncoder"
> passwordLocation="executable"
> passwordSource="sk.lenka.Application.test()"/>
> </driver>
>
>
> I wonder what to enter in "passwordSource" if I need to read the
> password from the method: lenka.Application.test();
>
>
> Any help will be appreciated.
> Lenka

Re: PasswordSource if passwordLocation is executable

Posted by Michael Gentry <mg...@masslight.net>.
Hi Lenka,

The passwordSource in the XML is overloaded in this case and should
reference the executable to run along with any parameters it needs.
It looks to me like you are trying to run a Java method?  If so,
you'll need to have a "java ..." command there.  I also suspect you
might could use the URL method.  I've used that in the past to read an
encrypted password off the filesystem.  For that, part of my XML
looked something like:

<login userName="username" encoderClass="my.TripleDESPasswordEncoder"
encoderSalt="94VW4MOreXfvbSbB6ewbfp3XkdoZvgwp" passwordLocation="url"
passwordSource="file:///usr/local/passwords/projectXYZ/password"/>

mrg


On Thu, Oct 29, 2009 at 3:45 AM, lenka <li...@gmail.com> wrote:
>
> Dear Cayenne users,
>
> I have a problem here. I need to change the password in a runtime.
> Therefore I set in Cayenne Modeler:
>
> in Password Encoder the following values:
> Password Location: Executable Program
> Password Executable: lenka.Application.test()"
>
> In the xml file, the following code was produced.
>
> <driver project-version="3.0" class="org.postgresql.Driver">
> <url value="jdbc:postgresql://127.0.0.1:5430/databaze_name"/>
> <connectionPool min="1" max="1"/>
> <login userName="user_name"
> encoderClass="org.apache.cayenne.conf.Rot47PasswordEncoder"
> passwordLocation="executable"
> passwordSource="sk.lenka.Application.test()"/>
> </driver>
>
>
> I wonder what to enter in "passwordSource" if I need to read the
> password from the method: lenka.Application.test();
>
>
> Any help will be appreciated.
> Lenka