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/