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