You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Pavel Moravec (JIRA)" <ji...@apache.org> on 2011/07/27 14:39:10 UTC

[jira] [Created] (QPID-3373) Java client: connectionFactory.createConnection method should not rewrite stored credentials

Java client: connectionFactory.createConnection method should not rewrite stored credentials
--------------------------------------------------------------------------------------------

                 Key: QPID-3373
                 URL: https://issues.apache.org/jira/browse/QPID-3373
             Project: Qpid
          Issue Type: Bug
          Components: Java Client
    Affects Versions: 0.10
            Reporter: Pavel Moravec
            Priority: Minor


Method connectionFactory.createConnection("foo", "bar") causes than Java client caches the credentials and overwrites default ones provided in connection URL. Thus subsequent calling of connectionFactory.createConnection() method (without a parameter) results in using the credentials "foo" / "bar" despite default ones should be used.


How reproducible:
100%


Steps to Reproduce:
1. Setup a broker with PLAIN authentication
2. Compile attached JUnit test 
3. Run it (java org.junit.runner.JUnitCore authNoCredentialsInSecondConnection)


Actual results:
In try .. catch block, connectionFactory2.createConnection(); does not raise an exception that authentication failed. (and thus fail command below raises java.lang.AssertionError exception). In fact, connectionFactory2.createConnection(); uses "guest" / "guest" credentials set for connectionFactory1.


Expected results:
Authentication fails for connectionFactory2.createConnection(); as it uses default credentials from URL (what is "dummy" / "dummy").


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Updated] (QPID-3373) Java client: connectionFactory.createConnection method should not rewrite stored credentials

Posted by "Pavel Moravec (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel Moravec updated QPID-3373:
--------------------------------

    Attachment:     (was: qpid-java-0.10.connection_credentials.patch)

> Java client: connectionFactory.createConnection method should not rewrite stored credentials
> --------------------------------------------------------------------------------------------
>
>                 Key: QPID-3373
>                 URL: https://issues.apache.org/jira/browse/QPID-3373
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.10
>            Reporter: Pavel Moravec
>            Priority: Minor
>         Attachments: authNoCredentialsInSecondConnection.java.gz
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Method connectionFactory.createConnection("foo", "bar") causes than Java client caches the credentials and overwrites default ones provided in connection URL. Thus subsequent calling of connectionFactory.createConnection() method (without a parameter) results in using the credentials "foo" / "bar" despite default ones should be used.
> How reproducible:
> 100%
> Steps to Reproduce:
> 1. Setup a broker with PLAIN authentication
> 2. Compile attached JUnit test 
> 3. Run it (java org.junit.runner.JUnitCore authNoCredentialsInSecondConnection)
> Actual results:
> In try .. catch block, connectionFactory2.createConnection(); does not raise an exception that authentication failed. (and thus fail command below raises java.lang.AssertionError exception). In fact, connectionFactory2.createConnection(); uses "guest" / "guest" credentials set for connectionFactory1.
> Expected results:
> Authentication fails for connectionFactory2.createConnection(); as it uses default credentials from URL (what is "dummy" / "dummy").

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Updated] (QPID-3373) Java client: connectionFactory.createConnection method should not rewrite stored credentials

Posted by "Pavel Moravec (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel Moravec updated QPID-3373:
--------------------------------

    Attachment: qpid-java-0.10.connection_credentials.patch

patch proposal

> Java client: connectionFactory.createConnection method should not rewrite stored credentials
> --------------------------------------------------------------------------------------------
>
>                 Key: QPID-3373
>                 URL: https://issues.apache.org/jira/browse/QPID-3373
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.10
>            Reporter: Pavel Moravec
>            Priority: Minor
>         Attachments: qpid-java-0.10.connection_credentials.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Method connectionFactory.createConnection("foo", "bar") causes than Java client caches the credentials and overwrites default ones provided in connection URL. Thus subsequent calling of connectionFactory.createConnection() method (without a parameter) results in using the credentials "foo" / "bar" despite default ones should be used.
> How reproducible:
> 100%
> Steps to Reproduce:
> 1. Setup a broker with PLAIN authentication
> 2. Compile attached JUnit test 
> 3. Run it (java org.junit.runner.JUnitCore authNoCredentialsInSecondConnection)
> Actual results:
> In try .. catch block, connectionFactory2.createConnection(); does not raise an exception that authentication failed. (and thus fail command below raises java.lang.AssertionError exception). In fact, connectionFactory2.createConnection(); uses "guest" / "guest" credentials set for connectionFactory1.
> Expected results:
> Authentication fails for connectionFactory2.createConnection(); as it uses default credentials from URL (what is "dummy" / "dummy").

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Updated] (QPID-3373) Java client: connectionFactory.createConnection method should not rewrite stored credentials

Posted by "Pavel Moravec (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel Moravec updated QPID-3373:
--------------------------------

    Attachment: authNoCredentialsInSecondConnection.java.gz

JUnit test case for reproduction

> Java client: connectionFactory.createConnection method should not rewrite stored credentials
> --------------------------------------------------------------------------------------------
>
>                 Key: QPID-3373
>                 URL: https://issues.apache.org/jira/browse/QPID-3373
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.10
>            Reporter: Pavel Moravec
>            Priority: Minor
>         Attachments: authNoCredentialsInSecondConnection.java.gz, qpid-java-0.10.connection_credentials.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Method connectionFactory.createConnection("foo", "bar") causes than Java client caches the credentials and overwrites default ones provided in connection URL. Thus subsequent calling of connectionFactory.createConnection() method (without a parameter) results in using the credentials "foo" / "bar" despite default ones should be used.
> How reproducible:
> 100%
> Steps to Reproduce:
> 1. Setup a broker with PLAIN authentication
> 2. Compile attached JUnit test 
> 3. Run it (java org.junit.runner.JUnitCore authNoCredentialsInSecondConnection)
> Actual results:
> In try .. catch block, connectionFactory2.createConnection(); does not raise an exception that authentication failed. (and thus fail command below raises java.lang.AssertionError exception). In fact, connectionFactory2.createConnection(); uses "guest" / "guest" credentials set for connectionFactory1.
> Expected results:
> Authentication fails for connectionFactory2.createConnection(); as it uses default credentials from URL (what is "dummy" / "dummy").

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Updated] (QPID-3373) Java client: connectionFactory.createConnection method should not rewrite stored credentials

Posted by "Pavel Moravec (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel Moravec updated QPID-3373:
--------------------------------

    Comment: was deleted

(was: patch proposal)

> Java client: connectionFactory.createConnection method should not rewrite stored credentials
> --------------------------------------------------------------------------------------------
>
>                 Key: QPID-3373
>                 URL: https://issues.apache.org/jira/browse/QPID-3373
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.10
>            Reporter: Pavel Moravec
>            Priority: Minor
>         Attachments: authNoCredentialsInSecondConnection.java.gz
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Method connectionFactory.createConnection("foo", "bar") causes than Java client caches the credentials and overwrites default ones provided in connection URL. Thus subsequent calling of connectionFactory.createConnection() method (without a parameter) results in using the credentials "foo" / "bar" despite default ones should be used.
> How reproducible:
> 100%
> Steps to Reproduce:
> 1. Setup a broker with PLAIN authentication
> 2. Compile attached JUnit test 
> 3. Run it (java org.junit.runner.JUnitCore authNoCredentialsInSecondConnection)
> Actual results:
> In try .. catch block, connectionFactory2.createConnection(); does not raise an exception that authentication failed. (and thus fail command below raises java.lang.AssertionError exception). In fact, connectionFactory2.createConnection(); uses "guest" / "guest" credentials set for connectionFactory1.
> Expected results:
> Authentication fails for connectionFactory2.createConnection(); as it uses default credentials from URL (what is "dummy" / "dummy").

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Resolved] (QPID-3373) Java client: connectionFactory.createConnection method should not rewrite stored credentials

Posted by "Rajith Attapattu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rajith Attapattu resolved QPID-3373.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 0.14
         Assignee: Rajith Attapattu

Fixed with an automated test case.

> Java client: connectionFactory.createConnection method should not rewrite stored credentials
> --------------------------------------------------------------------------------------------
>
>                 Key: QPID-3373
>                 URL: https://issues.apache.org/jira/browse/QPID-3373
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.10
>            Reporter: Pavel Moravec
>            Assignee: Rajith Attapattu
>            Priority: Minor
>             Fix For: 0.14
>
>         Attachments: authNoCredentialsInSecondConnection.java.gz, qpid-java-0.10.connection_credentials.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Method connectionFactory.createConnection("foo", "bar") causes than Java client caches the credentials and overwrites default ones provided in connection URL. Thus subsequent calling of connectionFactory.createConnection() method (without a parameter) results in using the credentials "foo" / "bar" despite default ones should be used.
> How reproducible:
> 100%
> Steps to Reproduce:
> 1. Setup a broker with PLAIN authentication
> 2. Compile attached JUnit test 
> 3. Run it (java org.junit.runner.JUnitCore authNoCredentialsInSecondConnection)
> Actual results:
> In try .. catch block, connectionFactory2.createConnection(); does not raise an exception that authentication failed. (and thus fail command below raises java.lang.AssertionError exception). In fact, connectionFactory2.createConnection(); uses "guest" / "guest" credentials set for connectionFactory1.
> Expected results:
> Authentication fails for connectionFactory2.createConnection(); as it uses default credentials from URL (what is "dummy" / "dummy").

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Commented] (QPID-3373) Java client: connectionFactory.createConnection method should not rewrite stored credentials

Posted by "Alex Rudyy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-3373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13095307#comment-13095307 ] 

Alex Rudyy commented on QPID-3373:
----------------------------------

Rajith,

when test from ConnectionFactoryTest is run as part of any existing test profile it fails because broker port is not 5672.

I would suggest to add the following change into ConnectionFactoryTest
{code}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionFactoryTest.java b/qpid/java/systests/src/main/java/org/a
index 0b9ef8c..d128c5d 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionFactoryTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionFactoryTest.java
@@ -13,7 +13,8 @@ public class ConnectionFactoryTest extends QpidBrokerTestCase
      */
     public void testCreateConnectionWithUsernamePassword() throws Exception
     {
-        String URL = "amqp://guest:guest@clientID/test?brokerlist='tcp://localhost:5672'";
+        String brokerUrl = getBroker().toString();
+        String URL = "amqp://guest:guest@clientID/test?brokerlist='" + brokerUrl + "'";
         AMQConnectionFactory factory = new AMQConnectionFactory(URL);
         
         AMQConnection con = (AMQConnection)factory.createConnection();

{code}
With this change the test will pass on existing java profiles


Alternatively, it can be excluded from all java test profiles.

What do you think about it?

> Java client: connectionFactory.createConnection method should not rewrite stored credentials
> --------------------------------------------------------------------------------------------
>
>                 Key: QPID-3373
>                 URL: https://issues.apache.org/jira/browse/QPID-3373
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.10
>            Reporter: Pavel Moravec
>            Assignee: Rajith Attapattu
>            Priority: Minor
>             Fix For: 0.14
>
>         Attachments: authNoCredentialsInSecondConnection.java.gz, qpid-java-0.10.connection_credentials.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Method connectionFactory.createConnection("foo", "bar") causes than Java client caches the credentials and overwrites default ones provided in connection URL. Thus subsequent calling of connectionFactory.createConnection() method (without a parameter) results in using the credentials "foo" / "bar" despite default ones should be used.
> How reproducible:
> 100%
> Steps to Reproduce:
> 1. Setup a broker with PLAIN authentication
> 2. Compile attached JUnit test 
> 3. Run it (java org.junit.runner.JUnitCore authNoCredentialsInSecondConnection)
> Actual results:
> In try .. catch block, connectionFactory2.createConnection(); does not raise an exception that authentication failed. (and thus fail command below raises java.lang.AssertionError exception). In fact, connectionFactory2.createConnection(); uses "guest" / "guest" credentials set for connectionFactory1.
> Expected results:
> Authentication fails for connectionFactory2.createConnection(); as it uses default credentials from URL (what is "dummy" / "dummy").

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Commented] (QPID-3373) Java client: connectionFactory.createConnection method should not rewrite stored credentials

Posted by "Rajith Attapattu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-3373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13095720#comment-13095720 ] 

Rajith Attapattu commented on QPID-3373:
----------------------------------------

Alex, I applied your patch and tested.
The tests should be ok now.

> Java client: connectionFactory.createConnection method should not rewrite stored credentials
> --------------------------------------------------------------------------------------------
>
>                 Key: QPID-3373
>                 URL: https://issues.apache.org/jira/browse/QPID-3373
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.10
>            Reporter: Pavel Moravec
>            Assignee: Rajith Attapattu
>            Priority: Minor
>             Fix For: 0.14
>
>         Attachments: authNoCredentialsInSecondConnection.java.gz, qpid-java-0.10.connection_credentials.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Method connectionFactory.createConnection("foo", "bar") causes than Java client caches the credentials and overwrites default ones provided in connection URL. Thus subsequent calling of connectionFactory.createConnection() method (without a parameter) results in using the credentials "foo" / "bar" despite default ones should be used.
> How reproducible:
> 100%
> Steps to Reproduce:
> 1. Setup a broker with PLAIN authentication
> 2. Compile attached JUnit test 
> 3. Run it (java org.junit.runner.JUnitCore authNoCredentialsInSecondConnection)
> Actual results:
> In try .. catch block, connectionFactory2.createConnection(); does not raise an exception that authentication failed. (and thus fail command below raises java.lang.AssertionError exception). In fact, connectionFactory2.createConnection(); uses "guest" / "guest" credentials set for connectionFactory1.
> Expected results:
> Authentication fails for connectionFactory2.createConnection(); as it uses default credentials from URL (what is "dummy" / "dummy").

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Updated] (QPID-3373) Java client: connectionFactory.createConnection method should not rewrite stored credentials

Posted by "Pavel Moravec (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel Moravec updated QPID-3373:
--------------------------------

    Attachment: qpid-java-0.10.connection_credentials.patch

patch proposal: 
1) have auxiliary connectionDetails interface derived from _connectionDetails and with the provided credentials
2)call AMQConnection method with this interface instead.

> Java client: connectionFactory.createConnection method should not rewrite stored credentials
> --------------------------------------------------------------------------------------------
>
>                 Key: QPID-3373
>                 URL: https://issues.apache.org/jira/browse/QPID-3373
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.10
>            Reporter: Pavel Moravec
>            Priority: Minor
>         Attachments: authNoCredentialsInSecondConnection.java.gz, qpid-java-0.10.connection_credentials.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Method connectionFactory.createConnection("foo", "bar") causes than Java client caches the credentials and overwrites default ones provided in connection URL. Thus subsequent calling of connectionFactory.createConnection() method (without a parameter) results in using the credentials "foo" / "bar" despite default ones should be used.
> How reproducible:
> 100%
> Steps to Reproduce:
> 1. Setup a broker with PLAIN authentication
> 2. Compile attached JUnit test 
> 3. Run it (java org.junit.runner.JUnitCore authNoCredentialsInSecondConnection)
> Actual results:
> In try .. catch block, connectionFactory2.createConnection(); does not raise an exception that authentication failed. (and thus fail command below raises java.lang.AssertionError exception). In fact, connectionFactory2.createConnection(); uses "guest" / "guest" credentials set for connectionFactory1.
> Expected results:
> Authentication fails for connectionFactory2.createConnection(); as it uses default credentials from URL (what is "dummy" / "dummy").

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org