Package org.apache.activemq.security

Examples of org.apache.activemq.security.SimpleAuthenticationPlugin


    broker.addConnector(BROKER_BIND_URL);
    broker.setTmpDataDirectory(tmpDir);
    broker.setDataDirectoryFile(dataDir);
    List<AuthenticationUser> users = Lists.newArrayList();
    users.add(new AuthenticationUser(USERNAME, PASSWORD, ""));
    SimpleAuthenticationPlugin authentication = new SimpleAuthenticationPlugin(users);
    broker.setPlugins(new BrokerPlugin[]{authentication});
    broker.start();

    context = new Context();
    context.put(JMSSourceConfiguration.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
View Full Code Here


                info("failed to apply modified AuthorizationMap to AuthorizationBroker", e);
            }

        } else if (candidate instanceof DtoSimpleAuthenticationPlugin) {
            try {
                final SimpleAuthenticationPlugin updatedPlugin = fromDto(candidate, new SimpleAuthenticationPlugin());
                final SimpleAuthenticationBroker authenticationBroker =
                    (SimpleAuthenticationBroker) getBrokerService().getBroker().getAdaptor(SimpleAuthenticationBroker.class);
                addConnectionWork.add(new Runnable() {
                    public void run() {
                        authenticationBroker.setUserGroups(updatedPlugin.getUserGroups());
                        authenticationBroker.setUserPasswords(updatedPlugin.getUserPasswords());
                        authenticationBroker.setAnonymousAccessAllowed(updatedPlugin.isAnonymousAccessAllowed());
                        authenticationBroker.setAnonymousUser(updatedPlugin.getAnonymousUser());
                        authenticationBroker.setAnonymousGroup(updatedPlugin.getAnonymousGroup());
                    }
                });
            } catch (Exception e) {
                info("failed to apply SimpleAuthenticationPlugin modifications to SimpleAuthenticationBroker", e);
            }
View Full Code Here

    }

    protected BrokerPlugin configureAuthentication() throws Exception {
        List<AuthenticationUser> users = new ArrayList<AuthenticationUser>();
        users.add(new AuthenticationUser(USER, GOOD_USER_PASSWORD, "users"));
        SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin(users);

        return authenticationPlugin;
    }
View Full Code Here

    protected BrokerPlugin configureAuthentication() throws Exception {
        List<AuthenticationUser> users = new ArrayList<AuthenticationUser>();
        users.add(new AuthenticationUser("system", "manager", "users,admins"));
        users.add(new AuthenticationUser("user", "password", "users"));
        users.add(new AuthenticationUser("guest", "password", "guests"));
        SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin(users);

        return authenticationPlugin;
    }
View Full Code Here

    broker.addConnector(BROKER_BIND_URL);
    broker.setTmpDataDirectory(tmpDir);
    broker.setDataDirectoryFile(dataDir);
    List<AuthenticationUser> users = Lists.newArrayList();
    users.add(new AuthenticationUser(USERNAME, PASSWORD, ""));
    SimpleAuthenticationPlugin authentication = new SimpleAuthenticationPlugin(users);
    broker.setPlugins(new BrokerPlugin[]{authentication});
    broker.start();

    context = new Context();
    context.put(JMSSourceConfiguration.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
View Full Code Here

    protected BrokerPlugin configureAuthentication() throws Exception {
        List<AuthenticationUser> users = new ArrayList<AuthenticationUser>();
        users.add(new AuthenticationUser("system", "manager", "users,admins"));
        users.add(new AuthenticationUser("user", "password", "users"));
        users.add(new AuthenticationUser("guest", "password", "guests"));
        SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin(users);

        return authenticationPlugin;
    }
View Full Code Here

    }

    private void configureAuthentication(BrokerService brokerService) throws Exception {
        LinkedList<AuthenticationUser> users = new LinkedList<AuthenticationUser>();
        users.add(new AuthenticationUser("user1", "user1", "anonymous,user1group"));
        final SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin(users);

        DefaultAuthorizationMap map = new DefaultAuthorizationMap();
        LinkedList<DestinationMapEntry> authz = new LinkedList<DestinationMapEntry>();
        AuthorizationEntry entry = new AuthorizationEntry();
        entry.setDestination(new ActiveMQTopic(">"));
        entry.setAdmin("admins");
        entry.setRead("admins,anonymous");
        entry.setWrite("admins");
        authz.add(entry);
        map.setAuthorizationEntries(authz);
        AuthorizationPlugin authorizationPlugin = new AuthorizationPlugin(map);
        authenticationPlugin.setAnonymousAccessAllowed(true);

        brokerService.setPlugins(new BrokerPlugin[]{
                authenticationPlugin, authorizationPlugin
        });
    }
View Full Code Here

    @Test(timeout = 60 * 1000)
    public void testFailedSubscription() throws Exception {
        addMQTTConnector();

        final SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin();
        authenticationPlugin.setAnonymousAccessAllowed(true);

        final String ANONYMOUS = "anonymous";
        authenticationPlugin.setAnonymousGroup(ANONYMOUS);
        final DefaultAuthorizationMap map = new DefaultAuthorizationMap();
        // only one authorized destination, anonymous for anonymous group!
        map.put(new ActiveMQTopic(ANONYMOUS), new GroupPrincipal(ANONYMOUS));
        final AuthorizationPlugin authorizationPlugin = new AuthorizationPlugin(new SimpleAuthorizationMap(map, map, map));

View Full Code Here

        addMQTTConnector();

        LinkedList<AuthenticationUser> users = new LinkedList<AuthenticationUser>();
        users.add(new AuthenticationUser("user", "user", "users"));
        users.add(new AuthenticationUser("admin", "admin", "admins"));
        final SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin(users);


        DefaultAuthorizationMap map = new DefaultAuthorizationMap();
        LinkedList<DestinationMapEntry> authz = new LinkedList<DestinationMapEntry>();
View Full Code Here

                info("failed to apply modified AuthorizationMap to AuthorizationBroker", e);
            }

        } else if (candidate instanceof DtoSimpleAuthenticationPlugin) {
            try {
                final SimpleAuthenticationPlugin updatedPlugin = fromDto(candidate, new SimpleAuthenticationPlugin());
                final SimpleAuthenticationBroker authenticationBroker =
                    (SimpleAuthenticationBroker) getBrokerService().getBroker().getAdaptor(SimpleAuthenticationBroker.class);
                addConnectionWork.add(new Runnable() {
                    public void run() {
                        authenticationBroker.setUserGroups(updatedPlugin.getUserGroups());
                        authenticationBroker.setUserPasswords(updatedPlugin.getUserPasswords());
                        authenticationBroker.setAnonymousAccessAllowed(updatedPlugin.isAnonymousAccessAllowed());
                        authenticationBroker.setAnonymousUser(updatedPlugin.getAnonymousUser());
                        authenticationBroker.setAnonymousGroup(updatedPlugin.getAnonymousGroup());
                    }
                });
            } catch (Exception e) {
                info("failed to apply SimpleAuthenticationPlugin modifications to SimpleAuthenticationBroker", e);
            }
View Full Code Here

TOP

Related Classes of org.apache.activemq.security.SimpleAuthenticationPlugin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.