为ActiveMQ服务器设置安全验证

ActiveMQ下载默认不开启安全验证,级访问服务器不需要输入用户名、密码,如何开启安全验证:

1、ActiveMQ使用的是jetty服务器,服务器的安全开关配置在conf/jetty.xml配置文件中要开启安全验证只需修改authenticate的值为true,及修改如下代码 name="authenticate" 的value为true即可

<bean id="securityConstraint" class="org.eclipse.jetty.http.security.Constraint">

        <property name="name" value="BASIC" />
        <property name="roles" value="admin" />
        <property name="authenticate" value="false" />
</bean>

2、登录用户名和密码保存在conf/jetty-realm.properties文件中,内容如下:

## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements.  See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License.  You may obtain a copy of the License at
## 
## http://www.apache.org/licenses/LICENSE-2.0
## 
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
# Defines users that can access the web (console, demo, etc.)
# username: password [,rolename ...]

admin: admin, admin

如上所示,默认用户名为admin、密码为admin、拥有admin权限。如需修改用户名、密码、角色,对应修改上面的三个值即可

猜你喜欢

转载自blog.csdn.net/azhegps/article/details/78587374