2015-03-25 2 views
0

Можно ли ограничить доступ к сервлету определенному списку IP-адресов?Ограничить доступ к сервлетам по IP

Это связано с настраиваемой готовой системой, работающей на Weblogic 12.1.1.0. У меня нет доступа к исходному коду Java, но я могу изменять настройки в консоли Weblogic и непосредственно в файлах уха/войны.

Вот соответствующий файл 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> 

Заранее спасибо.

ответ

0

Я не знаю, как это сделать, используя только WebLogic. Однако вы можете использовать Apache для Front WebLogic и использовать модуль mod_authz_core для ограничения доступа по IP-адресу.

Смежные вопросы