activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ramsub <>
Subject Issue with custom security plugin
Date Thu, 03 Jan 2008 22:58:09 GMT

I'm developing a custom security plugin for my application. My idea is an 
implementation a kind of ACL, ie to allow only known clients. Code will
scrunitize the ipaddr of the client and will only allow the known ones. I'm
using version activemq4.1.0 and running into the following issue. 

- I intercept my embedded broker for addConnection; look at the ipaddr and
dont call addConnection until it's from known addr. But, still, connections
are being made from all clients. In fact, I even, added 'removeConnection',
which still doesn't work. I also intercepted 'addSession', and still the
same issue. 

Here's the relevant code snip: 

public class MGSecBroker extends BrokerFilter { 
    private static final Logger logger =

    public MGSecBroker (Broker next) { 

    public void addConnection(ConnectionContext context, ConnectionInfo
info) throws Exception { 
        String ipaddr = context.getConnection().getRemoteAddress(); 
        System.out.println("IPADDR from: " + ipaddr); 
        String subStr = ipaddr.substring(1,10); 
        if (subStr.equals("")) { 
            Throwable error = new Throwable("You're not allowed"); 
            super.removeConnection(context, info, error); 
        } else { 
            System.out.println("Connection is allowed"); 
            super.addConnection(context, info); 

public class MGSecPlugin implements BrokerPlugin { 
    private static final Logger logger =

    public Broker installPlugin(Broker broker) { 
            return new MGSecBroker(broker); 

public class MGEmbedBroker implements Runnable { 
        public MGEmbedBroker() { 
             broker = new BrokerService(); 
             broker.setPlugins(new BrokerPlugin[] { new MGSecPlugin ()} ); 

I see that broker is getting intercepted and "blocking" gets printed, but in
fact, connections are being made from clients. Could you let me know what
I'm missing here? 
View this message in context:
Sent from the ActiveMQ - Dev mailing list archive at

View raw message