选择应用服务:default
1、进入 default\deploy\management\console-mgr.sar\web-console.war\WEB-INF 目录下
路径:default\deploy\management\console-mgr.sar\web-console.war\WEB-INF\jboss-web.xml
查看 jboss-web.xml 如下(默认无需更改)
<?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd"> <jboss-web> <!-- Uncomment the security-domain to enable security. You will need to edit the htmladaptor login configuration to setup the login modules used to authentication users.--> <security-domain>java:/jaas/web-console</security-domain> <!-- The war depends on the --> <depends>jboss.admin:service=PluginManager</depends> </jboss-web>
2、修改jboss-web.xml 同级目录下web.xml
路径:default\deploy\management\console-mgr.sar\web-console.war\WEB-INF\web.xml
找到<security-constraint>节点
增加子节点:
<http-method>GET</http-method>
<http-method>POST</http-method>
具体修改如下:
<security-constraint> <web-resource-collection> <web-resource-name>HtmlAdaptor</web-resource-name> <description>An example security config that only allows users with the role JBossAdmin to access the HTML JMX console web application </description> <url-pattern>/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>JBossAdmin</role-name> </auth-constraint> </security-constraint>
3、进入/jboss-eap-4.3/jboss-as/server/default/conf 目录下
路径:default\config\login-config.xml
查看 login-config.xml
如下:
<application-policy name = "jmx-console"> <authentication> <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag = "required"> <module-option name="usersProperties">jmx-console-users.properties</module-option> <module-option name="rolesProperties">jmx-console-roles.properties</module-option> </login-module> </authentication> </application-policy>
4、进入 login-config.xml 同级的props目录下
路径:default\config\props
4.1 创建 web-console-roles.properties文件
增加内容:
admin=admin
4.2 创建 web-console-users.properties文件
增加内容:
admin=JBossAdmin,HttpInvoker
5、回到login-config.xml,修改其内容如下:
路径:default\config\login-config.xml
<application-policy name="JBossWS"> <authentication> <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required"> <module-option name="usersProperties">props/jbossws-users.properties</module-option> <module-option name="rolesProperties">props/jbossws-roles.properties</module-option> <module-option name="unauthenticatedIdentity">anonymous</module-option> </login-module> </authentication> </application-policy>