【发布时间】:2015-03-27 07:37:44
【问题描述】:
是否可以将对 Servlet 的访问限制为已定义的 IP 地址列表?
这与在 Weblogic 12.1.1.0 上运行的可配置现成系统有关。我无权访问 Java 源代码,但我可以在 Weblogic 控制台中修改设置,也可以直接在 ear/war 文件中修改设置。
这是描述我要保护的 Web 服务应用程序的相关 web.xml 文件。
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="XyzWSWebApp">
<display-name>Xyz Web Services</display-name>
<description>Xyz Web Service Web-App</description>
<servlet>
<servlet-name>AxisServlet</servlet-name>
<servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
<init-param>
<param-name>axis.attachments.Directory</param-name>
<param-value>${java.io.tmpdir}/axis/attachments</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>25</session-timeout>
</session-config>
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xsd</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<security-constraint>
<web-resource-collection>
<web-resource-name>Xyz Web Services</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description>Users access Xyz Web Services</description>
<role-name>AgileUser</role-name>
</auth-constraint>
<user-data-constraint>
<description>Define whether to use SSL to transport data</description>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Unprotect web service URL</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
</web-resource-collection>
<user-data-constraint>
<description>Define whether to use SSL to transport data</description>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>XyzRealm</realm-name>
</login-config>
<security-role>
<description>Users access Xyz</description>
<role-name>XyzUser</role-name>
</security-role>
</web-app>
提前致谢。
【问题讨论】:
标签: weblogic