activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "scott.d.dagastino" <>
Subject activemq authentication through plugins
Date Tue, 09 Sep 2008 18:19:07 GMT

I'm attempting to write my own plugin authentication module for activemq.  I
have created a bean that extends the broker plugin and register it with
activemq.xml " <bean
class=""/>".  it will fire
off the constructor with no problem but I want it to register the
userid/password (hard coded for now) with the activemq core so if
someone(user) is attempting to logon with invalid userid/password then it
will reject the connection request.  I will eventually pull the
userid/password from a database. 
1.  how do I get the userid/password into the security core through the
plugin without having to restart activemq
2.   how do I get the "installBroker" method to fire in my custom plugin.

Here is the plugin code I have created:
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page:
// Decompiler options: packimports(3) 
// Source File Name:


import java.util.*;
import org.apache.activemq.jaas.GroupPrincipal;

// Referenced classes of package
//            SimpleAuthenticationBroker, AuthenticationUser

public class FltwindsAuthentication
    implements BrokerPlugin

    public FltwindsAuthentication() {
    	System.out.println("Hello world from my own plugin...:  Current time: "
+ new Date());
    	AuthenticationUser user = new AuthenticationUser("SysAdm", "SysAdm",
    	List list = new ArrayList();
    public Broker installPlugin(Broker broker)
    	System.out.println("SDD install plugin");
        return new SimpleAuthenticationBroker(broker, userPasswords,

    public Map getUserGroups()
        return userGroups;

    public void setUsers(List users)
        userPasswords = new HashMap();
        userGroups = new HashMap();
        AuthenticationUser user;
        Set groups;
        for(Iterator it = users.iterator(); it.hasNext();
userGroups.put(user.getUsername(), groups))
            user = (AuthenticationUser);
            userPasswords.put(user.getUsername(), user.getPassword());
            groups = new HashSet();
            String name;
            for(StringTokenizer iter = new StringTokenizer(user.getGroups(),
","); iter.hasMoreTokens(); groups.add(new GroupPrincipal(name)))
                name = iter.nextToken().trim();



    public void setUserGroups(Map userGroups)
        this.userGroups = userGroups;

    public Map getUserPasswords()
        return userPasswords;

    public void setUserPasswords(Map userPasswords)
        this.userPasswords = userPasswords;

    private Map userPasswords;
    private Map userGroups;

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message