If I want to implement JAAS authorization on Apache ActiveMQ, do I have to use the plug-in in the activemq.xml configuration file?
This way is really NOT good becaus
I found some code snippets that ended up being tremendously helpful in getting started on this subject:
http://activemq.2283324.n4.nabble.com/Fully-programmatic-authorization-map-tp2344815.html
Here's how I ended up using it (may not be the best way):
public class TestAuthorizationPlugin extends AuthorizationPlugin {
Then:
@Override
public Broker installPlugin(Broker broker) {
List entries = new ArrayList();
try {
entries.add(makeTopicAuthorization("groupA.topic", "groupA", "groupA", "groupA"));
entries.add(makeQueueAuthorization("groupA.queue", "groupA", "groupA", "groupA"));
entries.add(makeQueueAuthorization("groupB.queue", "groupB", "groupB", "groupB"));
entries.add(makeTopicAuthorization("ActiveMQ.Advisory.>", "all", "all", "all"));
AuthorizationMap authMap = new DefaultAuthorizationMap(entries);
return new AuthorizationBroker(broker, authMap);
} catch (Exception e) {
LOGGER.error(e);
}
return new AuthorizationBroker(broker, null);
}
jar this and stick it in
.
Modify the activemq.xml:
Another helpful link for more info on autho plugin dev:
http://mariuszprzydatek.com/2014/01/04/token-based-authentication-plugin-for-activemq/