本文整理汇总了Java中org.apache.activemq.security.SimpleAuthenticationPlugin.setAnonymousAccessAllowed方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleAuthenticationPlugin.setAnonymousAccessAllowed方法的具体用法?Java SimpleAuthenticationPlugin.setAnonymousAccessAllowed怎么用?Java SimpleAuthenticationPlugin.setAnonymousAccessAllowed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.security.SimpleAuthenticationPlugin
的用法示例。
在下文中一共展示了SimpleAuthenticationPlugin.setAnonymousAccessAllowed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureAuthentication
import org.apache.activemq.security.SimpleAuthenticationPlugin; //导入方法依赖的package包/类
protected BrokerPlugin configureAuthentication() throws Exception {
List<AuthenticationUser> users = new ArrayList<AuthenticationUser>();
users.add(new AuthenticationUser(USERNAME_ADMIN, PASSWORD_ADMIN, "users,admins"));
users.add(new AuthenticationUser(USERNAME_USER, PASSWORD_USER, "users"));
users.add(new AuthenticationUser(USERNAME_GUEST, PASSWORD_GUEST, "guests"));
SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin(users);
authenticationPlugin.setAnonymousAccessAllowed(isAnonymousAccessAllowed());
return authenticationPlugin;
}
示例2: configureAuthentication
import org.apache.activemq.security.SimpleAuthenticationPlugin; //导入方法依赖的package包/类
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);
authenticationPlugin.setAnonymousAccessAllowed(true);
return authenticationPlugin;
}
示例3: start
import org.apache.activemq.security.SimpleAuthenticationPlugin; //导入方法依赖的package包/类
public Broker start() {
LOGGER.info("Starting broker using brokerURL: [" + brokerURL + "]");
try {
broker = new BrokerService();
broker.setPersistent(false);
broker.deleteAllMessages();
broker.setDeleteAllMessagesOnStartup(true);
broker.setUseJmx(false);
broker.getSystemUsage().getTempUsage().setLimit(USAGE_LIMIT);
broker.getSystemUsage().getStoreUsage().setLimit(USAGE_LIMIT);
broker.addConnector(brokerURL);
if (username != null) {
AuthenticationUser user = new AuthenticationUser(username, password, "producers,consumer");
SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin();
authenticationPlugin.setAnonymousAccessAllowed(false);
authenticationPlugin.setUsers(singletonList(user));
broker.setPlugins(new BrokerPlugin[]{authenticationPlugin});
}
broker.start();
} catch (Exception e) {
throw new RuntimeException(e);
}
LOGGER.info("Successfully started broker");
return this;
}