我有一个用于两个域(stage.xyz.com和www.xyz.com)的EAR。现在,我需要根据请求所在的域来应用安全约束 来自
例如:如果URL模式: stage.xyz.com/ca/api/rest/us/doc1.pdf
如果URL模式是 www.xyz.com/ca/api/rest/us/doc1.pdf
可以在web.xml中添加此类约束,但是随后我将需要创建两个EAR文件;有没有一种方法可以编码安全性约束,而无需创建单独的EAR文件?
<security-constraint>
<display-name>Authorization</display-name>
<web-resource-collection>
<web-resource-name>Secured area</web-resource-name>
<description />
<url-pattern>/ca/api/rest/us/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<description />
<role-name>file-access-group</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/error.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>file-access-group</role-name>
</security-role>