zoukankan      html  css  js  c++  java
  • ActiveMQ安全机制设置

    一、设置后台管理密码
    a、ActiveMQ使用的是jetty服务器,找到D:divapache-activemq-5.11.1confjetty.xml文件:

    <bean id="adminSecurityConstraint" class="org.eclipse.jetty.util.security.Constraint">
        <property name="name" value="BASIC" />
        <property name="roles" value="admin" />
        <!-- set authenticate=false to disable login -->
        <property name="authenticate" value="true" />
    </bean>

    注意:低版本的authenticate的属性默认为"false",需要改为"true",高版本的已经默认为true

    b、修改控制台的登录用户名密码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
    #user: user, user
    ljq: ljq, admin

    二、消息生产者和消费者密码认证
    a、D:divapache-activemq-5.11.1confactivemq.xml添加生产者和消费者密码认证信息:

    b、设置用户名密码,文件在D:divapache-activemq-5.11.1confcredentials.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 credentials that will be used by components (like web console) to access the broker
    
    activemq.username=ljq
    activemq.password=ljq
    guest.password=password

    三、在Java生产者和消费者端设置用户名密码才能连接

    ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("ljq", "ljq", "failover:(tcp://localhost:61616)?Randomize=false");
  • 相关阅读:
    HDUoj(1002)A + B Problem II
    HIT Summer 20180731
    Windows10下python3.5对维基百科语料用word2vec进行训练寻找同义词相似度
    关键词抽取
    win10+python遇到:Using TensorFlow backend.错误
    Windows下Python3.5+numpy+keras+tesorflow的环境配置
    常用的一些序列号
    Umbraco扩展开发
    Umbraco Content属性
    Windows查看端口占用
  • 原文地址:https://www.cnblogs.com/linjiqin/p/6504758.html
Copyright © 2011-2022 走看看