You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by sk123 <sk...@savi.com> on 2008/03/27 23:49:04 UTC

Simple Authentication Plugin

Hi,

I am trying to understand ActiveMQ's security feature. 

I started with simple authentication but seem to be missing something. I
have search the forum as well as Google but no luck.

My test starts the embedded broker and makes a connection. Based on the
users defined, I expect the request to create connection would fail as the
user is invalid but that does not happen. What am I missing?

Here is my test code:

            broker = new BrokerService();
            broker.setUseJmx(true);
            broker.addConnector("tcp://localhost:61616");
            
            SimpleAuthenticationPlugin authenticationPlugin = new
SimpleAuthenticationPlugin();
            List users = new ArrayList();
            users.add(new AuthenticationUser("system", "manager",
"users,admins"));
            users.add(new AuthenticationUser("user", "password", "users"));
            users.add(new AuthenticationUser("guest", "password",
"guests"));
            authenticationPlugin.setUsers(users);
            broker.setPlugins(new BrokerPlugin[] {authenticationPlugin});
            
            // broker.setDataDirectory(DATA_DICTIONARY_DIR);
            broker.start();            
            
            //Create a VM connection
            String user = "Tom";
            String url = broker.getVmConnectorURI().toASCIIString();

            System.out.println("Connecting to URL: " + url);
            if (vmConnectionFactory == null) {
                vmConnectionFactory = new ActiveMQConnectionFactory(user,
null, url);
            }

            try {
                connection = vmConnectionFactory.createConnection(user,
null);
            }
            catch (JMSException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }


Please advice

TIA
sk

-- 
View this message in context: http://www.nabble.com/Simple-Authentication-Plugin-tp16340202s2354p16340202.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Simple Authentication Plugin

Posted by sk123 <sk...@savi.com>.
Thanks Rob!!

Moving addConnector() to the last work.




rajdavies wrote:
> 
> 
> On 27 Mar 2008, at 22:49, sk123 wrote:
> 
>>
>> Hi,
>>
>> I am trying to understand ActiveMQ's security feature.
>>
>> I started with simple authentication but seem to be missing  
>> something. I
>> have search the forum as well as Google but no luck.
>>
>> My test starts the embedded broker and makes a connection. Based on  
>> the
>> users defined, I expect the request to create connection would fail  
>> as the
>> user is invalid but that does not happen. What am I missing?
>>
>> Here is my test code:
>>
>>            broker = new BrokerService();
>>            broker.setUseJmx(true);
>>            broker.addConnector("tcp://localhost:61616");
>>
>>            SimpleAuthenticationPlugin authenticationPlugin = new
>> SimpleAuthenticationPlugin();
>>            List users = new ArrayList();
>>            users.add(new AuthenticationUser("system", "manager",
>> "users,admins"));
>>            users.add(new AuthenticationUser("user", "password",  
>> "users"));
>>            users.add(new AuthenticationUser("guest", "password",
>> "guests"));
>>            authenticationPlugin.setUsers(users);
>>            broker.setPlugins(new BrokerPlugin[]  
>> {authenticationPlugin});
>>
>>            // broker.setDataDirectory(DATA_DICTIONARY_DIR);
>>            broker.start();
>>
>>            //Create a VM connection
>>            String user = "Tom";
>>            String url = broker.getVmConnectorURI().toASCIIString();
>>
>>            System.out.println("Connecting to URL: " + url);
>>            if (vmConnectionFactory == null) {
>>                vmConnectionFactory = new  
>> ActiveMQConnectionFactory(user,
>> null, url);
>>            }
>>
>>            try {
>>                connection = vmConnectionFactory.createConnection(user,
>> null);
>>            }
>>            catch (JMSException e) {
>>                // TODO Auto-generated catch block
>>                e.printStackTrace();
>>            }
>>
>>
>> Please advice
>>
>> TIA
>> sk
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Simple-Authentication-Plugin-tp16340202s2354p16340202.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
> 
> Try moving the the setJMX() and addConnector() to the last thing you  
> do with the broker before calling start
> 
> 
> 
> cheers,
> 
> Rob
> 
> http://open.iona.com/ -Enterprise Open Integration
> http://rajdavies.blogspot.com/
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Simple-Authentication-Plugin-tp16340202s2354p16398809.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Simple Authentication Plugin

Posted by Rob Davies <ra...@gmail.com>.
On 27 Mar 2008, at 22:49, sk123 wrote:

>
> Hi,
>
> I am trying to understand ActiveMQ's security feature.
>
> I started with simple authentication but seem to be missing  
> something. I
> have search the forum as well as Google but no luck.
>
> My test starts the embedded broker and makes a connection. Based on  
> the
> users defined, I expect the request to create connection would fail  
> as the
> user is invalid but that does not happen. What am I missing?
>
> Here is my test code:
>
>            broker = new BrokerService();
>            broker.setUseJmx(true);
>            broker.addConnector("tcp://localhost:61616");
>
>            SimpleAuthenticationPlugin authenticationPlugin = new
> SimpleAuthenticationPlugin();
>            List users = new ArrayList();
>            users.add(new AuthenticationUser("system", "manager",
> "users,admins"));
>            users.add(new AuthenticationUser("user", "password",  
> "users"));
>            users.add(new AuthenticationUser("guest", "password",
> "guests"));
>            authenticationPlugin.setUsers(users);
>            broker.setPlugins(new BrokerPlugin[]  
> {authenticationPlugin});
>
>            // broker.setDataDirectory(DATA_DICTIONARY_DIR);
>            broker.start();
>
>            //Create a VM connection
>            String user = "Tom";
>            String url = broker.getVmConnectorURI().toASCIIString();
>
>            System.out.println("Connecting to URL: " + url);
>            if (vmConnectionFactory == null) {
>                vmConnectionFactory = new  
> ActiveMQConnectionFactory(user,
> null, url);
>            }
>
>            try {
>                connection = vmConnectionFactory.createConnection(user,
> null);
>            }
>            catch (JMSException e) {
>                // TODO Auto-generated catch block
>                e.printStackTrace();
>            }
>
>
> Please advice
>
> TIA
> sk
>
> -- 
> View this message in context: http://www.nabble.com/Simple-Authentication-Plugin-tp16340202s2354p16340202.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Try moving the the setJMX() and addConnector() to the last thing you  
do with the broker before calling start



cheers,

Rob

http://open.iona.com/ -Enterprise Open Integration
http://rajdavies.blogspot.com/