[jboss-user] [JBoss Messaging] - Re: JBM and JAAS Client authentication
btsibr
do-not-reply at jboss.com
Wed Aug 1 08:37:24 EDT 2007
Interesting, because it does seem to work with reading messages (or it's not authenticating the user at all on write which seems unlikely).
Note that I am using secured JNDI, so the JAAS login is working for that.
Pardon any mistyping as I can't copy/paste:
| public static void main(String[] args) {
| try {
| System.setProperty("java.security.auth.login.config",ClassLoader.getSystemResource("jaas.config").getPath());
| LoginContext loginContext = new LoginContext("other", new StaticIdentityCallbackHandler("admin","admin");
| loginContext.login();
|
| InitialContext ctx = new InitialContext();
| ConnectionFactory f = (ConnectionFactory)ctx.lookup("ConnectionFactory");
| Destination dest = (Destination)ctx.lookup("echoService/jms/request");
|
| // This fails on the READ
| Connection conn = f.createConnection();
| conn.start();
| Session session = conn.createSession(true, Session.CLIENT_ACKNOWLEDGE);
|
| MessageProducer producer = session.createProducer(dest);
|
| for (int i = 0; i < 5; i++) {
| Message m = session.createTestMessage("Hello " + i);
| producer.send(m);
| }
|
| session.commit();
| producer.close();
|
| MessageConsumer consumer = session.createConsumer(dest);
|
| Message mess = null;
| while ((mess = consumer.receive(3000)) != null) {
| System.out.println(((TextMessage)mess).getText());
| }
| session.commit();
|
| consumer.close();
| session.close();
| conn.close();
|
| loginContext.logout();
| } catch (Exception e) {
| e.printStackTrace();
| }
|
A few small points, the StaticIdentityCallbackHandler is a simple callback handler I wrote to just return the username and password to the callbacks.
Both JNDI (I'm using the HTTPNamingContext) and JBM are configure to use the same JAAS domain.
What is involved in making the connection capable of using the client login config?
Thanks for any information.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069605#4069605
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069605
More information about the jboss-user
mailing list