4 Replies Latest reply on Oct 6, 2003 10:56 AM by Adrian Brock

    How to authenticate a user?

    arabin Novice

      I am trying to create a QueueConnection, using the method with username and password.
      What is wrong?

      I have the following file jbossmq-state.xml:

      <?xml version="1.0" encoding="UTF-8"?>



      john
      needle
      DurableSubscriberExample


      SYSTEM
      1


      1



      2



      guest
      guest


      nobody
      nobody


      dynsub
      dynsub




      guest
      john
      SYSTEM
      1
      2


      john
      SYSTEM
      1
      2


      john
      dynsub
      SYSTEM
      1
      2


      john
      dynsub
      SYSTEM
      1
      2


      nobody




      DurableSubscriberExample
      AnotherExample
      testTopic





      I have the following exception:

      2003-10-04 20:41:25,583 DEBUG [org.jboss.mq.sm.file.DynamicLoginModule] Bad password for username=SYSTEM
      2003-10-04 20:41:25,583 DEBUG [org.jboss.security.plugins.JaasSecurityManager.jbossmq] Login failure
      javax.security.auth.login.FailedLoginException: Password Incorrect/Password Required
      at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:154)
      at org.jboss.mq.sm.file.DynamicLoginModule.login(DynamicLoginModule.java:72)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at javax.security.auth.login.LoginContext.invoke(LoginContext.java:675)
      at javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
      at javax.security.auth.login.LoginContext$4.run(LoginContext.java:610)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:607)
      at javax.security.auth.login.LoginContext.login(LoginContext.java:534)
      at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:487)
      at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:442)
      at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:244)
      at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:219)
      at org.jboss.mq.security.SecurityManager.authenticate(SecurityManager.java:191)
      at org.jboss.mq.security.ServerSecurityInterceptor.authenticate(ServerSecurityInterceptor.java:51)
      at org.jboss.mq.server.TracingInterceptor.authenticate(TracingInterceptor.java:650)
      at org.jboss.mq.server.JMSServerInvoker.authenticate(JMSServerInvoker.java:288)
      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:333)
      at java.lang.Thread.run(Thread.java:534)
      2003-10-04 20:41:25,583 WARN [org.jboss.mq.il.oil.OILServerILService] Client request resulted in a server exception:
      javax.jms.JMSSecurityException: User: SYSTEM is NOT authenticated
      at org.jboss.mq.security.SecurityManager.authenticate(SecurityManager.java:215)
      at org.jboss.mq.security.ServerSecurityInterceptor.authenticate(ServerSecurityInterceptor.java:51)
      at org.jboss.mq.server.TracingInterceptor.authenticate(TracingInterceptor.java:650)
      at org.jboss.mq.server.JMSServerInvoker.authenticate(JMSServerInvoker.java:288)
      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:333)
      at java.lang.Thread.run(Thread.java:534)
      2003-10-04 20:41:25,633 DEBUG [org.jboss.mq.sm.file.DynamicLoginModule] Bad password for username=SYSTEM
      2003-10-04 20:41:25,633 DEBUG [org.jboss.security.plugins.JaasSecurityManager.jbossmq] Login failure
      javax.security.auth.login.FailedLoginException: Password Incorrect/Password Required
      at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:154)
      at org.jboss.mq.sm.file.DynamicLoginModule.login(DynamicLoginModule.java:72)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at javax.security.auth.login.LoginContext.invoke(LoginContext.java:675)
      at javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
      at javax.security.auth.login.LoginContext$4.run(LoginContext.java:610)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:607)
      at javax.security.auth.login.LoginContext.login(LoginContext.java:534)
      at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:487)
      at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:442)
      at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:244)
      at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:219)
      at org.jboss.mq.security.SecurityManager.authenticate(SecurityManager.java:191)
      at org.jboss.mq.security.ServerSecurityInterceptor.authenticate(ServerSecurityInterceptor.java:51)
      at org.jboss.mq.server.TracingInterceptor.authenticate(TracingInterceptor.java:650)
      at org.jboss.mq.server.JMSServerInvoker.authenticate(JMSServerInvoker.java:288)
      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:333)
      at java.lang.Thread.run(Thread.java:534)
      2003-10-04 20:41:25,633 WARN [org.jboss.mq.il.oil.OILServerILService] Client request resulted in a server exception:
      javax.jms.JMSSecurityException: User: SYSTEM is NOT authenticated
      at org.jboss.mq.security.SecurityManager.authenticate(SecurityManager.java:215)
      at org.jboss.mq.security.ServerSecurityInterceptor.authenticate(ServerSecurityInterceptor.java:51)
      at org.jboss.mq.server.TracingInterceptor.authenticate(TracingInterceptor.java:650)
      at org.jboss.mq.server.JMSServerInvoker.authenticate(JMSServerInvoker.java:288)
      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:333)
      at java.lang.Thread.run(Thread.java:534)
      2003-10-04 20:41:25,653 DEBUG [org.jboss.mq.sm.file.DynamicLoginModule] Bad password for username=SYSTEM
      2003-10-04 20:41:25,653 DEBUG [org.jboss.security.plugins.JaasSecurityManager.jbossmq] Login failure
      javax.security.auth.login.FailedLoginException: Password Incorrect/Password Required
      at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:154)
      at org.jboss.mq.sm.file.DynamicLoginModule.login(DynamicLoginModule.java:72)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at javax.security.auth.login.LoginContext.invoke(LoginContext.java:675)
      at javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
      at javax.security.auth.login.LoginContext$4.run(LoginContext.java:610)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:607)
      at javax.security.auth.login.LoginContext.login(LoginContext.java:534)
      at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:487)
      at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:442)
      at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:244)
      at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:219)
      at org.jboss.mq.security.SecurityManager.authenticate(SecurityManager.java:191)
      at org.jboss.mq.security.ServerSecurityInterceptor.authenticate(ServerSecurityInterceptor.java:51)
      at org.jboss.mq.server.TracingInterceptor.authenticate(TracingInterceptor.java:650)
      at org.jboss.mq.server.JMSServerInvoker.authenticate(JMSServerInvoker.java:288)
      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:333)
      at java.lang.Thread.run(Thread.java:534)
      2003-10-04 20:41:25,653 WARN [org.jboss.mq.il.oil.OILServerILService] Client request resulted in a server exception:
      javax.jms.JMSSecurityException: User: SYSTEM is NOT authenticated
      at org.jboss.mq.security.SecurityManager.authenticate(SecurityManager.java:215)
      at org.jboss.mq.security.ServerSecurityInterceptor.authenticate(ServerSecurityInterceptor.java:51)
      at org.jboss.mq.server.TracingInterceptor.authenticate(TracingInterceptor.java:650)
      at org.jboss.mq.server.JMSServerInvoker.authenticate(JMSServerInvoker.java:288)
      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:333)
      at java.lang.Thread.run(Thread.java:534)

        • 1. Re: How to authenticate a user?
          arabin Novice

          I am definitely using username "SYSTEM" and password "1" to create QueueConnection as arguments of createQueueConnection, executed on the QueueConnectionFactory.

          • 2. Re: How to authenticate a user?
            Adrian Brock Master

            It looks ok to me.
            Are you sure there is no stray whitespace somewhere?

            Regards,
            Adrian

            • 3. Re: How to authenticate a user?
              arabin Novice

              Sure. Moreover, when I changed password for user "SYSTEM" to "SYSTEM" from "1", it works OK. The quotes in my text are not actually part of username or password. They are just delimiters.
              So, it looks like password "1" is not actually recognized by the system.

              • 4. Re: How to authenticate a user?
                Adrian Brock Master

                It works for me.
                Try enabling TRACE for org.jboss.mq in conf/log4j.xml

                jbossmq-state.xml
                <?xml version="1.0" encoding="UTF-8"?>



                john
                needle
                DurableSubscriberExample


                guest
                guest


                SYSTEM
                1


                nobody
                nobody


                dynsub
                dynsub




                SYSTEM
                guest
                john


                john


                john
                dynsub


                john
                dynsub


                nobody






                test code
                package test.client;



                import javax.naming.*;



                import javax.jms.*;



                public class Client

                {

                public static void main(String[] args)

                throws Exception

                {

                QueueConnection connection = null;

                QueueSession session = null;

                try

                {

                InitialContext ctx = new InitialContext();



                log.info("Looking up connection");

                QueueConnectionFactory conFactory = (QueueConnectionFactory) ctx.lookup("UIL2ConnectionFactory");

                connection = (QueueConnection) conFactory.createQueueConnection("SYSTEM", "1");



                log.info("Looking up queue");

                Queue queue = (Queue) ctx.lookup("queue/testQueue");



                log.info("Creating session");

                session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);



                log.info("Creating message");

                TextMessage message = session.createTextMessage("hello");

                log.info("Creating sender");

                QueueSender sender = session.createSender(queue);

                log.info("Sending message");

                sender.send(message, DeliveryMode.NON_PERSISTENT, 4, 0);

                log.info("Closing sender");

                sender.close();

                log.info("Done");



                }

                finally

                {

                if (session!= null)

                session.close();

                if (connection != null)

                connection.close();

                }

                }



                public static class log

                {

                public static void info(String s)

                {

                System.out.println(s);

                }

                }

                }