我的web.xml中有以下安全配置。我正在使用IBM WAS并为我的应用程序选择了AD身份验证。作为AD配置的一部分,我已将TEST角色映射到AD组。现在,每次我进行部署时,映射都会消失。有没有办法坚持映射?
<security-role>
<description>Test</description>
<role-name>TEST</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>test</web-resource-name>
<url-pattern>/test/*</url-pattern>
<url-pattern>/rock/index.html</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>TEST</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/rock/signon/login.html</form-login-page>
<form-error-page>/rock/signon/login.html</form-error-page>
</form-login-config>
</login-config>
答案 0 :(得分:0)
有两种方法可以做到这一点
ibm-application-bnd.xml
application.xml
和ear/META-INF
我没有探索第二种选择,但我使用第一种方法解决了部署问题
<强> IBM-应用bnd.xml 强>
<?xml version="1.0" encoding="UTF-8"?>
<application-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-application-bnd_1_2.xsd"
xmlns="http://websphere.ibm.com/xml/ns/javaee"
version="1.2">
<security-role name="ROLE">
<group name="LDAP GROUP" />
</security-role>
</application-bnd>
<强> application.xml中强>
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
<display-name>rest-ear</display-name>
<module>
<web>
<web-uri>rest-1.0.0-SNAPSHOT.war</web-uri>
<context-root>/rest</context-root>
</web>
</module>
<security-role>
<role-name>ROLE</role-name>
</security-role>
</application>