[jboss-user] [JBoss Messaging] - How to specify the username and password when connecting to

alllle do-not-reply at jboss.com
Mon Jan 8 16:06:15 EST 2007


I searched this forum but didn't find any example so here is my problem:

I've got the JBoss Messaging installed/converted all okay, test QueueExample worked fine with no user security checking. I've modified the properties file used by the messaging security domain and added additional users / roles. Now, the question is, how do I specify the username and password from the client program?

I tried adding the following to the QueueExample:

  | 			java.util.Hashtable env = new java.util.Hashtable();
  | 			env.put(Context.SECURITY_PRINCIPAL, "user");
  | 			env.put(Context.SECURITY_CREDENTIALS, "pass4user");
  | 			env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory");
  | 
  | 		   ic = new InitialContext();
  | 
And that generates error:
javax.jms.JMSSecurityException: User: null is not authorized to write to destination testQueue

The messaging-users.properties file:

  | admin=pass4admin
  | user=pass4user
  | guest=guest
  | 

The messaging-roles.properties file:
admin=admin
  | user=user
  | guest=guest
  | 

And the messaging-service.xml file:

  |       <attribute name="SecurityDomain">java:/jaas/messaging</attribute>
  |       <attribute name="DefaultSecurityConfig">
  |         <security>
  |             <role name="admin" read="true" write="true" create="true"/>
  |             <role name="user" read="true" write="true" create="true"/>
  |         </security>
  |       </attribute>
  | 

As you can see, I removed the "guest" role from the the message-service.xml security settings. If I put the guest back, it worked just fine.

So any idea what I am doing wrong?

Thanks in advance.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3999204#3999204

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3999204



More information about the jboss-user mailing list