Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-775

MessageAuthorizationPolicy doesn't work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.0
    • 5.1.0
    • Broker
    • None
    • windows NT 2003 server

    Description

      Use default config, set a MessageAuthorizationPolicy to BrokerService and start the broker.
      There are several issues:
      1) In BrokerService::startTransportConnector() method, connector.setMessageAuthorizationPolicy(policy); is in the wrong place, it should be moved to almost the very end of the method, otherwise if you use JMX, the ManageedTransportConnector won't have authorization policy info.
      2) ManagedTransportConnector doesn't pass the auth policy to ManagedTransport, I think the easiest way to fix it is in AbstractConnection constructor,
      adding this line:
      this.messageAuthorizationPolicy = connector.getMessageAuthorizationPolicy();
      and remove this line:
      answer.setMessageAuthorizationPolicy(messageAuthorizationPolicy);
      from TransportConnector::createConnection(), then it will work for both TransportConnection and ManagedTransportConnection
      3) AbstrctConnection doesn't pass the auth policy to ConnectionContext, I think this can be fixed by adding this line:
      context.setMessageAuthorizationPolicy(this.getMessageAuthorizationPolicy());
      to AbstractConnection::processAddConnection() method.

      Now the auth policy can be reached by MessageAuthorizationPolicy::isAllowedToConsume(ConnectionContext context, Message message) method, but the real problem is message value is null, but we need to use it to check right, some of the right information is a property inside the message.

      Please take a look at the problem, thanks

      Attachments

        Activity

          People

            jstrachan James Strachan
            ning.li Ning Li
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: