ActiveMQ安全机制的介绍
安全机制一般包含验证(Authentication)和授权(Authorization)两部分。在ActiveMQ中,验证指通过访问者的用户名和密码实现用户身份的验证,授权指为消息目标(队列或主题)的读、写、管理指定具有相应权限的用户组,并为用户分配权限。ActiveMQ的安全机制基于插件实现。
ActiveMQ提供两种验证插件,分别是:
1)Simple authentication plugin-in;
2)JAAS(Java Authentication and Authorization Service)authentication plugin-in。
ActiveMQ提供一种授权插件:Authorization plugin-in。
一、简单的安全认证(使用SimpleAuthenticationPlugin)
(1)设置证书文件,放用户名和密码:${activemq.conf}/credentials.properties
activemq.username=system activemq.password=manager
(2)配置simpleAuthenticationPlugin,简单认证插件
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"> <!--加载属性配置文件--> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <value>file:${activemq.conf}/credentials.properties</value> </property> </bean> <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}"> <!--在Broker中,配置插件--> <plugins> <simpleAuthenticationPlugin> <users> <authenticationUser username="${activemq.username}" password="${activemq.password}" groups="users,admins"/> </users> </simpleAuthenticationPlugin> </plugins> ...... </broker> </beans>
(3)、在ConnectionFactory 初始化时
@Bean public PooledConnectionFactory PooledConnectionFactory(){ ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); connectionFactory.setBrokerURL(MQ_URL); connectionFactory.setUserName("system"); //用户名 connectionFactory.setPassword("manager"); //密码 PooledConnectionFactory PooledConnectionFactory = new PooledConnectionFactory(); PooledConnectionFactory.setConnectionFactory(connectionFactory); return PooledConnectionFactory; }
二、JAAS 太过繁琐
三、Authorization plugin-in
主要是对队列,主题等功能细分,在一般常见中很少使用。
#引用文章
相关推荐
apache-activemq-5.16.0.zip
主要讲解activemq的安装,使用,集群的搭建,以及拓展
消息中间件-ActiveMQ
消息中间件-activeMQ
apache-activemq-5.9.0-bin.zip
apache-activemq-5.15.15二进制包,安装包,apache-activemq-5.15.15-bin.tar.gz
apache-activemq-5.8.0-bin.zip
简单示例如何 使用
解压缩apache-activemq-5.5.1-bin.zip,然后双击apache-activemq-5.5.1\bin\activemq.bat运行ActiveMQ程序。 包含了apache-activemq-5.5.1-bin.zip以及ActiveMQ一个helloworld的demo启动ActiveMQ以后,登陆:...
apache-activemq-5.16.0
tar -zxvf apache-activemq-5.15.12-bin.tar.gz 2.进入bin目录 cd /apache-activemq-5.15.12/bin 3.运行,没有配置环境变量只能在bin目录下使用命令 ./activemq 4.配置环境变量,配置完环境变量之后...
MQ是消息中间件,是一种在分布式系统中应用程序借以传递消息的媒介,常用的有ActiveMQ,RabbitMQ,kafka。ActiveMQ是Apache下的开源项目,完全支持JMS1.1和J2EE1.4规范的JMS Provider实现。 特点: 1、支持多种...
apache-activemq-5.15.3-bin apache-activemq-5.15.3-bin
Apache ActiveMQ是Apache软件基金会的一个开源项目,是一个基于消息的通信中间件。ActiveMQ是JMS的一个具体实现,支持JMS的两种消息模型。ActiveMQ使用AMQP协议集成多平台应用,使用STOMP协议通过websockets在Web...
apache-activemq,运行需要依赖的jdk版本为11+
apache-activemq-5.11.2 附全解教程 apache-activemq-5.11.2 附全解教程
官方离线安装包,测试可用。请使用rpm -ivh [rpm完整包名] 进行安装
ActiveMQ是一种开源的基于JMS(Java Message Servie)规范的一种消息中间件的实现
apache-activemq-5.15.4-bin 最新版本 直接解压放到指定目录就可以用
apache-activemq-5.15.2-bin.zipapache-activemq-5.15.2-bin.zip