title: Authentication and authorization issue in Apache ActiveMQ 5.10.0 over SSL only in a Java project
body: <p>I am trying to configure Apache ActiveMQ 5.10.0 over SSL only and test for authentication and authorization on Windows7. In activemq.xml file I have </p>
  
  <pre><code>    &lt;sslContext&gt;         
      &lt;sslContext keyStore="file:${activemq.conf}/cert/broker.ks" keyStorePassword="password"     trustStore="file:${activemq.conf}/cert/client.ts" trustStorePassword="password"/&gt;      
      &lt;/sslContext&gt;
  &lt;transportConnectors&gt;
         &lt;transportConnector name="ssl" uri="ssl://127.0.0.1:61617?needClientAuth=true"/&gt;
          &lt;/transportConnectors&gt;
  </code></pre>
  
  <p>On starting the broker I am getting the message</p>
  
  <pre><code>INFO | Listening for connections at: ssl://127.0.0.1:61617?needClientAuth=true
   INFO | Connector ssl started
  </code></pre>
  
  <h2>So, my broker is ready to listen over ssl.</h2>
  
  <p>In other cmd I am starting my java spring project jar......and I am getting the following log :</p>
  
  <pre><code>[21 Jul 2014 15:07:59,146] [DEBUG] WireFormatNegotiator.negociate() - ssl://localhost/127.0.0.1:61617 after negotiation: OpenWireFormat{version=9, cacheEnabled=tru
  e, stackTraceEnabled=true, tightEncodingEnabled=true, sizePrefixDisabled=false, maxFrameSize=9223372036854775807}
  [21 Jul 2014 15:07:59,167] [DEBUG] TaskRunnerFactory.init() - Initialized TaskRunnerFactory[ActiveMQ Session Task] using ExecutorService: java.util.concurrent.Thre
  adPoolExecutor@650e1899[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
  [21 Jul 2014 15:07:59,169] [INFO ] WalletManager.run() -
  
  ########################## Wallet MANAGER UP ##########################
  [21 Jul 2014 15:07:59,181] [DEBUG] CustomJmsTemplate.execute() - Executing callback on JMS Session: PooledSession { ActiveMQSession {id=ID:Psylocke-59003-140598047
  8859-3:1:3,started=true} }
  [21 Jul 2014 15:07:59,219] [DEBUG] CustomJmsTemplate.doSend() - Sending created message: ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
  = null, originalDestination = null, originalTransactionId = null, producerId = null, destination = null, transactionId = null, expiration = 0, timestamp = 0, arriv
  al = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = false, type = null, priority = 0, groupID = null, groupSequence = 0
  , targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@18f9a7a8, marshalledProperties = null, dataStructure
  = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false}
  [21 Jul 2014 15:07:59,229] [DEBUG] CustomJmsTemplate.execute() - Executing callback on JMS Session: PooledSession { ActiveMQSession {id=ID:Psylocke-59003-140598047
  8859-1:1:2,started=true} }
  [21 Jul 2014 15:07:59,260] [DEBUG] CustomJmsTemplate.doSend() - Sending created message: ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
  = null, originalDestination = null, originalTransactionId = null, producerId = null, destination = null, transactionId = null, expiration = 0, timestamp = 0, arriv
  al = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = false, type = null, priority = 0, groupID = null, groupSequence = 0
  , targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@ca2027f, marshalledProperties = null, dataStructure =
   null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false}
  [21 Jul 2014 15:07:59,312] [DEBUG] WalletManager.processUIMessage() - ### UI ### GetWalletPositions processing stared ### UI ###
  [21 Jul 2014 15:07:59,313] [DEBUG] WalletManager.processUIMessage() - ### UI ### GetWalletPositions processing ended ### UI ###
  [21 Jul 2014 15:08:19,036] [DEBUG] AbstractInactivityMonitor.run() - WriteChecker 10001 ms elapsed since last write check.
  [21 Jul 2014 15:08:19,038] [DEBUG] AbstractInactivityMonitor.run() - Running WriteCheck[tcp://127.0.0.1:61617]
  [21 Jul 2014 15:08:19,145] [DEBUG] AbstractInactivityMonitor.run() - WriteChecker 10000 ms elapsed since last write check.
  [21 Jul 2014 15:08:19,145] [DEBUG] AbstractInactivityMonitor.run() - Running WriteCheck[tcp://127.0.0.1:61617]
  [21 Jul 2014 15:08:29,036] [DEBUG] AbstractInactivityMonitor.run() - WriteChecker 10000 ms elapsed since last write check.
  [21 Jul 2014 15:08:29,036] [DEBUG] AbstractInactivityMonitor.run() - Running WriteCheck[tcp://127.0.0.1:61617]
  [21 Jul 2014 15:08:29,145] [DEBUG] AbstractInactivityMonitor.run() - WriteChecker 10000 ms elapsed since last write check.
  </code></pre>
  
  <h2>For authentication and authorization purpose I am using the below plugin in activemq.xml. I want only the "system" user to connect and no other guest user or incorrect username should access :</h2>
  
  <pre><code>&lt;plugins&gt;
          &lt;!-- Configure authentication; Username, passwords and groups --&gt;
          &lt;simpleAuthenticationPlugin&gt;
              &lt;users&gt;
                  &lt;authenticationUser username="system" password="${activemq.password}" groups="users,admins"/&gt;
              &lt;/users&gt;
          &lt;/simpleAuthenticationPlugin&gt;
  
  
        &lt;!--  Lets configure a destination based authorization mechanism --&gt;
        &lt;authorizationPlugin&gt;
          &lt;map&gt;
            &lt;authorizationMap&gt;
              &lt;authorizationEntries&gt;
                &lt;authorizationEntry queue="&gt;" read="admins" write="admins" admin="admins" /&gt;
                &lt;authorizationEntry queue="USERS.&gt;" read="users" write="users" admin="users" /&gt;
  
                &lt;authorizationEntry topic="&gt;" read="admins" write="admins" admin="admins" /&gt;
                &lt;authorizationEntry topic="USERS.&gt;" read="users" write="users" admin="users" /&gt;
  
                &lt;!-- &lt;authorizationEntry topic="ActiveMQ.Advisory.&gt;" read="guests,users" write="guests,users" admin="guests,users"/&gt; --&gt;
              &lt;/authorizationEntries&gt;
            &lt;/authorizationMap&gt;
          &lt;/map&gt;
        &lt;/authorizationPlugin&gt;
      &lt;/plugins&gt;
  </code></pre>
  
  <h2>In my spring context file for the WalletManager project i have</h2>
  
  <pre><code>    &lt;bean id="activeMQConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory"   destroy-method="stop" &gt;
          &lt;property name="connectionFactory"&gt;
              &lt;bean class="org.apache.activemq.ActiveMQSslConnectionFactory"&gt;
                  &lt;property name="brokerURL"&gt;
                      &lt;value&gt;ssl://${activemq.zdchange.hostname}:${activemq.zdchange.port}&lt;/value&gt;
                  &lt;/property&gt;
                  &lt;property name="keyStore" value="broker.ks"/&gt;
                  &lt;property name="keyStorePassword" value="keypass"/&gt;
                  &lt;property name="trustStore" value="client.ts"/&gt;
                  &lt;property name="trustStorePassword" value="keypass"/&gt;
                   &lt;property name="userName" value="system"/&gt;
                  &lt;property name="password" value="manager"/&gt; 
                  &lt;property name="redeliveryPolicy" ref="redeliveryPolicy"/&gt;
                  &lt;property name="useAsyncSend" value="true"/&gt; 
              &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;!--  JMS Connection Factory for walletcontroller --&gt;
      &lt;bean id="activeMQConnectionFactory_forSC" class="org.apache.activemq.pool.PooledConnectionFactory" destroy-method="stop" &gt;
          &lt;property name="connectionFactory"&gt;
              &lt;bean class="org.apache.activemq.ActiveMQSslConnectionFactory"&gt;
                  &lt;property name="brokerURL"&gt;
  
                      &lt;value&gt;ssl://${activemq.sc.hostname}:${activemq.sc.port}&lt;/value&gt;
                  &lt;/property&gt;
                  &lt;property name="keyStore" value="broker.ks"/&gt;
                  &lt;property name="keyStorePassword" value="keypass"/&gt;
                  &lt;property name="trustStore" value="client.ts"/&gt;
                  &lt;property name="trustStorePassword" value="keypass"/&gt;
                   &lt;property name="userName" value="system"/&gt;
                  &lt;property name="password" value="manager"/&gt; 
                  &lt;property name="redeliveryPolicy" ref="redeliveryPolicy"/&gt;
                  &lt;property name="useAsyncSend" value="true"/&gt; 
              &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>Now even if I am giving incorrect password for "system" or commenting the below lines </p>
  
  <pre><code>&lt;property name="userName" value="system"/&gt;
                      &lt;property name="password" value="manager"/&gt;
  </code></pre>
  
  <p>still it is getting connected to the broker. Is my authentication and authorization not done properly?</p>