這廝

          observing

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            48 Posts :: 3 Stories :: 3 Comments :: 0 Trackbacks
          web.xml


          <?xml version="1.0" encoding="UTF-8"?>
          <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns
          ="http://java.sun.com/xml/ns/javaee"
                  xmlns:web
          ="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
              xsi:schemaLocation
          ="http://java.sun.com/xml/ns/javaee
                  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

              id
          ="WebApp_ID" version="2.5">

              <display-name>JSFSpringNoSecurityWebApp</display-name>

              <!-- Spring configuration file location -->
              <context-param>
                  <param-name>contextConfigLocation</param-name>
                  <param-value>
                      /WEB-INF/applicationContext-business.xml
                      /WEB-INF/applicationContext-security.xml
                  </param-value>
              </context-param>


              <!-- Let Spring handle all requests coming to the web application through this filter. -->
              <filter>
                  <filter-name>springSecurityFilterChain</filter-name>
                  <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
              </filter>

           
              <!-- All the requests to be handled by the above filter -->
              <filter-mapping>
                <filter-name>springSecurityFilterChain</filter-name>
                <url-pattern>/*</url-pattern>
              </filter-mapping>


              <!-- To start/stop Spring framework automatically. -->
              <listener>
                  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
              </listener>

              <welcome-file-list>
                  <welcome-file>index.html</welcome-file>
                  <welcome-file>index.htm</welcome-file>
                  <welcome-file>index.jsp</welcome-file>
                  <welcome-file>default.html</welcome-file>
                  <welcome-file>default.htm</welcome-file>
                  <welcome-file>default.jsp</welcome-file>
              </welcome-file-list>

              <servlet>
                  <servlet-name>Faces Servlet</servlet-name>
                  <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                  <load-on-startup>1</load-on-startup>
              </servlet>
              <servlet-mapping>
                  <servlet-name>Faces Servlet</servlet-name>
                  <url-pattern>/faces/*</url-pattern>
              </servlet-mapping>
          </web-app>


          newly added applicationContext-security.xml  
          <?xml version="1.0" encoding="UTF-8"?>
          <beans:beans xmlns="http://www.springframework.org/schema/security"
              xmlns:xsi
          ="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:beans
          ="http://www.springframework.org/schema/beans"
              xsi:schemaLocation
          ="http://www.springframework.org/schema/beans
                  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                  http://www.springframework.org/schema/security
                  http://www.springframework.org/schema/security/spring-security-3.0.xsd"
          >
              

              <!-- Method based security -->
              <global-method-security>
                  <protect-pointcut access="ROLE_SPECIAL_USER"
                    expression
          ="execution(* org.swview.springsecuritytestapp.logic.Calculator.add(..))"/>
                  <protect-pointcut access="ROLE_GENERAL_USER"
                    expression
          ="execution(* org.swview.springsecuritytestapp.logic.Calculator.subtract(..))"/>
              </global-method-security>
              

              <!-- URL pattern based security -->
              <http auto-config="true">
                  <intercept-url pattern="/**" access="ROLE_GENERAL_USER, ROLE_SPECIAL_USER" />
              </http>


              <!--
              Usernames/Passwords are
                  kamal/swview
                  test/spring
              
          -->
              <authentication-manager>
                  <authentication-provider>
                      <password-encoder hash="md5"/>
                      <user-service>
                          <user name="kamal"
                             password
          ="65dc70650690999922d7dcd99dbd4033" authorities="ROLE_SPECIAL_USER" />
                          <user name="test"
                             password
          ="2a2d595e6ed9a0b24f027f2b63b134d6" authorities="ROLE_GENERAL_USER" />
                      </user-service>
                  </authentication-provider>
              </authentication-manager>

          </beans:beans>




          other files remain the same...








                  
          posted on 2011-12-26 12:44 cnbarry 閱讀(295) 評論(0)  編輯  收藏 所屬分類: Java
          主站蜘蛛池模板: 龙州县| 五峰| 满洲里市| 丘北县| 定陶县| 马公市| 汤原县| 美姑县| 泸水县| 沙坪坝区| 古浪县| 林芝县| 阳山县| 乌拉特后旗| 临泽县| 赤水市| 石河子市| 玛曲县| 江安县| 泰州市| 青海省| 罗田县| 邯郸市| 嘉鱼县| 仙游县| 南江县| 枞阳县| 镇坪县| 大荔县| 北安市| 澄城县| 怀仁县| 邵武市| 新宁县| 当雄县| 黎平县| 定边县| 昂仁县| 礼泉县| 兴文县| 台山市|