activemq無賬戶密碼登錄配置修改


activemq版本   5.15.0

程序路徑  /app/activemq61616.1616/

配置文件路徑     /app/activemq61616.1616/conf

修改配置文件jetty.xml第32行跟38行,true改為false

修改完成,重啟MQ服務。

 

jetty.xml配置文件內容如下

  1     <!--
  2         Licensed to the Apache Software Foundation (ASF) under one or more contributor
  3         license agreements. See the NOTICE file distributed with this work for additional
  4         information regarding copyright ownership. The ASF licenses this file to You under
  5         the Apache License, Version 2.0 (the "License"); you may not use this file except in
  6         compliance with the License. You may obtain a copy of the License at
  7 
  8         http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or
  9         agreed to in writing, software distributed under the License is distributed on an
 10         "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 11         implied. See the License for the specific language governing permissions and
 12         limitations under the License.
 13     -->
 14     <!--
 15         An embedded servlet engine for serving up the Admin consoles, REST and Ajax APIs and
 16         some demos Include this file in your configuration to enable ActiveMQ web components
 17         e.g. <import resource="jetty.xml"/>
 18     -->
 19 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 20     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
 21 
 22     <bean id="securityLoginService" class="org.eclipse.jetty.security.HashLoginService">
 23         <property name="name" value="ActiveMQRealm" />
 24         <property name="config" value="${activemq.conf}/jetty-realm.properties" />
 25     </bean>
 26 
 27     <bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
 28         <property name="name" value="BASIC" />
 29         <property name="roles" value="user,admin" />
 30         <!-- set authenticate=false to disable login -->
 31         <property name="authenticate" value="false" />
 32     </bean>
 33     <bean id="adminSecurityConstraint" class="org.eclipse.jetty.util.security.Constraint">
 34         <property name="name" value="BASIC" />
 35         <property name="roles" value="admin" />
 36          <!-- set authenticate=false to disable login -->
 37         <property name="authenticate" value="false" />
 38     </bean>
 39     <bean id="securityConstraintMapping" class="org.eclipse.jetty.security.ConstraintMapping">
 40         <property name="constraint" ref="securityConstraint" />
 41         <property name="pathSpec" value="/api/*,/admin/*,*.jsp" />
 42     </bean>
 43     <bean id="adminSecurityConstraintMapping" class="org.eclipse.jetty.security.ConstraintMapping">
 44         <property name="constraint" ref="adminSecurityConstraint" />
 45         <property name="pathSpec" value="*.action" />
 46     </bean>
 47     
 48     <bean id="rewriteHandler" class="org.eclipse.jetty.rewrite.handler.RewriteHandler">
 49         <property name="rules">
 50             <list>
 51                 <bean id="header" class="org.eclipse.jetty.rewrite.handler.HeaderPatternRule">
 52                   <property name="pattern" value="*"/>
 53                   <property name="name" value="X-FRAME-OPTIONS"/>
 54                   <property name="value" value="SAMEORIGIN"/>
 55                 </bean>
 56             </list>
 57         </property>
 58     </bean>
 59     
 60     <bean id="secHandlerCollection" class="org.eclipse.jetty.server.handler.HandlerCollection">
 61         <property name="handlers">
 62             <list>
 63                    <ref bean="rewriteHandler"/>
 64                 <bean class="org.eclipse.jetty.webapp.WebAppContext">
 65                     <property name="contextPath" value="/admin" />
 66                     <property name="resourceBase" value="${activemq.home}/webapps/admin" />
 67                     <property name="logUrlOnStart" value="true" />
 68                 </bean>
 69                 <bean class="org.eclipse.jetty.webapp.WebAppContext">
 70                     <property name="contextPath" value="/api" />
 71                     <property name="resourceBase" value="${activemq.home}/webapps/api" />
 72                     <property name="logUrlOnStart" value="true" />
 73                 </bean>
 74                 <bean class="org.eclipse.jetty.server.handler.ResourceHandler">
 75                     <property name="directoriesListed" value="false" />
 76                     <property name="welcomeFiles">
 77                         <list>
 78                             <value>index.html</value>
 79                         </list>
 80                     </property>
 81                     <property name="resourceBase" value="${activemq.home}/webapps/" />
 82                 </bean>
 83                 <bean id="defaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler">
 84                     <property name="serveIcon" value="false" />
 85                 </bean>
 86             </list>
 87         </property>
 88     </bean>    
 89     <bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
 90         <property name="loginService" ref="securityLoginService" />
 91         <property name="authenticator">
 92             <bean class="org.eclipse.jetty.security.authentication.BasicAuthenticator" />
 93         </property>
 94         <property name="constraintMappings">
 95             <list>
 96                 <ref bean="adminSecurityConstraintMapping" />
 97                 <ref bean="securityConstraintMapping" />
 98             </list>
 99         </property>
100         <property name="handler" ref="secHandlerCollection" />
101     </bean>
102 
103     <bean id="contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection">
104     </bean>
105 
106     <bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
107              <!-- the default port number for the web console -->
108         <property name="host" value="0.0.0.0"/>
109         <property name="port" value="1616"/>
110     </bean>
111 
112     <bean id="Server" depends-on="jettyPort" class="org.eclipse.jetty.server.Server"
113         destroy-method="stop">
114 
115         <property name="handler">
116             <bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
117                 <property name="handlers">
118                     <list>
119                         <ref bean="contexts" />
120                         <ref bean="securityHandler" />
121                     </list>
122                 </property>
123             </bean>
124         </property>
125 
126     </bean>
127 
128     <bean id="invokeConnectors" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
129         <property name="targetObject" ref="Server" />
130         <property name="targetMethod" value="setConnectors" />
131         <property name="arguments">
132         <list>
133                <bean id="Connector" class="org.eclipse.jetty.server.ServerConnector">
134                    <constructor-arg ref="Server" />
135                     <!-- see the jettyPort bean -->
136                    <property name="host" value="#{systemProperties['jetty.host']}" />
137                    <property name="port" value="#{systemProperties['jetty.port']}" />
138                </bean>
139                 <!--
140                     Enable this connector if you wish to use https with web console
141                 -->
142                 <!-- bean id="SecureConnector" class="org.eclipse.jetty.server.ServerConnector">
143                     <constructor-arg ref="Server" />
144                     <constructor-arg>
145                         <bean id="handlers" class="org.eclipse.jetty.util.ssl.SslContextFactory">
146                         
147                             <property name="keyStorePath" value="${activemq.conf}/broker.ks" />
148                             <property name="keyStorePassword" value="password" />
149                         </bean>
150                     </constructor-arg>
151                     <property name="port" value="8162" />
152                 </bean -->
153             </list>
154         </property>
155     </bean>
156 
157     <bean id="configureJetty" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
158         <property name="staticMethod" value="org.apache.activemq.web.config.JspConfigurer.configureJetty" />
159         <property name="arguments">
160             <list>
161                 <ref bean="Server" />
162                 <ref bean="secHandlerCollection" />
163             </list>
164         </property>
165     </bean>
166     
167     <bean id="invokeStart" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" 
168         depends-on="configureJetty, invokeConnectors">
169         <property name="targetObject" ref="Server" />
170         <property name="targetMethod" value="start" />      
171     </bean>
172     
173     
174 </beans>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM