Changes between Version 1 and Version 2 of acegi-security

차이점 주위로
다음 차이점은 무시하기:
작성자:
anonymous (IP: 221.150.127.103)
날짜/시간:
2012-08-24 AM 2:11:48 (13 년 전)
설명:

--

Legend:

변경되지 않음
추가됨
제거됨
변경됨
  • acegi-security

    v1 v2  
    9292 
    9393}}} 
     94 
     95* dispatcher-servlet.xml 
     96{{{ 
     97<?xml version="1.0" encoding="UTF-8"?> 
     98<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> 
     99 
     100<beans> 
     101 
     102        <!-- Controller definitions --> 
     103        <bean id="indexController" 
     104                class="springweb.controller.IndexController"> 
     105                <property name="greeting"> 
     106                        <value>Welcome to the Demo App!!</value> 
     107                </property> 
     108        </bean> 
     109        <bean id="logoutController" 
     110                class="springweb.controller.LogoutController" /> 
     111        <bean id="initParamSubmitController" 
     112                class="springweb.controller.InitParamSubmitController" /> 
     113        <bean id="paramSubmitController" 
     114                class="springweb.controller.ParamSubmitController"> 
     115                <property name="sessionForm"> 
     116                        <value>false</value> 
     117                </property> 
     118                <property name="commandName"> 
     119                        <value>simplePersonForm</value> 
     120                </property> 
     121                <property name="commandClass"> 
     122                        <value>springweb.form.SimplePersonForm</value> 
     123                </property> 
     124                <property name="validator"> 
     125                        <bean 
     126                                class="springweb.form.validator.SimplePersonFormValidator" /> 
     127                </property> 
     128                <property name="formView"> 
     129                        <value>initparamsubmit</value> 
     130                </property> 
     131                <property name="successView"> 
     132                        <value>/secure/app/paramsubmit.htm</value> 
     133                </property> 
     134        </bean> 
     135        <bean id="initAdminController" 
     136                class="springweb.controller.InitAdminController" /> 
     137 
     138 
     139        <!-- URL Mapping definition --> 
     140        <bean id="simpleUrlMapping" 
     141                class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> 
     142                <property name="mappings"> 
     143                        <props> 
     144                                <prop key="/index.htm">indexController</prop> 
     145                                <prop key="/logout.htm">logoutController</prop> 
     146                                <prop key="/secure/app/initparamsubmit.htm"> 
     147                                        initParamSubmitController 
     148                                </prop> 
     149                                <prop key="/secure/app/paramsubmit.htm"> 
     150                                        paramSubmitController 
     151                                </prop> 
     152                                <prop key="/secure/admin/initadmin.htm"> 
     153                                        initAdminController 
     154                                </prop> 
     155                        </props> 
     156                </property> 
     157        </bean> 
     158 
     159        <!-- View Resolver definition --> 
     160        <bean id="xmlViewResolver" 
     161                class="org.springframework.web.servlet.view.XmlViewResolver"> 
     162                <property name="location"> 
     163                        <value>/WEB-INF/springweb-views.xml</value> 
     164                </property> 
     165        </bean> 
     166 
     167        <!-- ****** START ACEGI Security Configuration *******--> 
     168        <!-- ======================== FILTER CHAIN ======================= --> 
     169 
     170        <!--  if you wish to use channel security, add "channelProcessingFilter," in front 
     171                of "httpSessionContextIntegrationFilter" in the list below --> 
     172        <bean id="filterChainProxy" 
     173                class="org.acegisecurity.util.FilterChainProxy"> 
     174                <property name="filterInvocationDefinitionSource"> 
     175                        <value> 
     176                                CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON 
     177                                PATTERN_TYPE_APACHE_ANT 
     178                                /**=httpSessionContextIntegrationFilter,formAuthenticationProcessingFilter,exceptionTranslationFilter,filterSecurityInterceptor 
     179                        </value> 
     180                </property> 
     181        </bean> 
     182 
     183        <!-- Start Security filter config --> 
     184        <bean id="exceptionTranslationFilter" 
     185                class="org.acegisecurity.ui.ExceptionTranslationFilter"> 
     186                <property name="authenticationEntryPoint"> 
     187                        <ref bean="formLoginAuthenticationEntryPoint" /> 
     188                </property> 
     189        </bean> 
     190 
     191        <!-- Define filter to handle BASIC authentication --> 
     192        <bean id="basicProcessingFilter" 
     193                class="org.acegisecurity.ui.basicauth.BasicProcessingFilter"> 
     194                <property name="authenticationManager"> 
     195                        <ref bean="authenticationManager" /> 
     196                </property> 
     197                <property name="authenticationEntryPoint"> 
     198                        <ref bean="authenticationEntryPoint" /> 
     199                </property> 
     200        </bean> 
     201 
     202        <!-- Define realm for BASIC login--> 
     203        <bean id="authenticationEntryPoint" 
     204                class="org.acegisecurity.ui.basicauth.BasicProcessingFilterEntryPoint"> 
     205                <property name="realmName"> 
     206                        <value>Spring Web Realm</value> 
     207                </property> 
     208        </bean> 
     209 
     210        <!-- Define filter to handle FORM authentication --> 
     211        <bean id="formAuthenticationProcessingFilter" 
     212                class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter"> 
     213                <property name="filterProcessesUrl"> 
     214                        <value>/j_acegi_security_check</value> 
     215                </property> 
     216                <property name="authenticationFailureUrl"> 
     217                        <value>/loginFailed.html</value> 
     218                </property> 
     219                <property name="defaultTargetUrl"> 
     220                        <value>/</value> 
     221                </property> 
     222                <property name="authenticationManager"> 
     223                        <ref bean="authenticationManager" /> 
     224                </property> 
     225        </bean> 
     226 
     227        <!-- Define realm for FORM login--> 
     228        <bean id="formLoginAuthenticationEntryPoint" 
     229                class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint"> 
     230                <property name="loginFormUrl"> 
     231                        <value>/login.jsp</value> 
     232                </property> 
     233                <property name="forceHttps"> 
     234                        <value>false</value> 
     235                </property> 
     236        </bean> 
     237 
     238        <bean id="httpSessionContextIntegrationFilter" 
     239                class="org.acegisecurity.context.HttpSessionContextIntegrationFilter"> 
     240        </bean> 
     241        <!-- End Security filter config --> 
     242 
     243        <!-- Start Security interceptor config --> 
     244        <!-- Define authentication manager, decision manager and secure URL patterns --> 
     245        <bean id="filterSecurityInterceptor" 
     246                class="org.acegisecurity.intercept.web.FilterSecurityInterceptor"> 
     247                <property name="authenticationManager"> 
     248                        <ref bean="authenticationManager" /> 
     249                </property> 
     250                <property name="accessDecisionManager"> 
     251                        <ref bean="accessDecisionManager" /> 
     252                </property> 
     253                <property name="objectDefinitionSource"> 
     254                        <value> 
     255                                CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON 
     256                                PATTERN_TYPE_APACHE_ANT  
     257                                /secure/admin/*=ROLE_ADMIN 
     258                                /secure/app/*=ROLE_USER 
     259                        </value> 
     260                </property> 
     261        </bean> 
     262        <!-- End Security interceptor config --> 
     263 
     264        <!-- Start authentication config --> 
     265        <bean id="authenticationManager" 
     266                class="org.acegisecurity.providers.ProviderManager"> 
     267                <property name="providers"> 
     268                        <list> 
     269                                <ref bean="daoAuthenticationProvider" /> 
     270                        </list> 
     271                </property> 
     272        </bean> 
     273 
     274        <bean id="daoAuthenticationProvider" 
     275                class="org.acegisecurity.providers.dao.DaoAuthenticationProvider"> 
     276                <property name="userDetailsService"> 
     277                        <ref bean="userDetailsService" /> 
     278                </property> 
     279        </bean> 
     280 
     281        <!-- Authentication using In-memory Dao --> 
     282        <bean id="userDetailsService" 
     283                class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl"> 
     284                <property name="userMap"> 
     285                        <value> 
     286                                jklaassen=4moreyears,ROLE_ADMIN 
     287                                bouerj=ineedsleep,ROLE_USER 
     288                        </value> 
     289                </property> 
     290        </bean> 
     291                 
     292        <!-- Authentication using JDBC Dao --> 
     293        <!-- <bean id="userDetailsService" 
     294                class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl"> 
     295                <property name="dataSource"> 
     296                <ref bean="dataSource"/> 
     297                </property> 
     298                </bean> 
     299         --> 
     300                <!-- End authentication config --> 
     301 
     302        <!-- Start authorization config --> 
     303        <bean id="accessDecisionManager" 
     304                class="org.acegisecurity.vote.UnanimousBased"> 
     305                <property name="decisionVoters"> 
     306                        <list> 
     307                                <ref bean="roleVoter" /> 
     308                        </list> 
     309                </property> 
     310        </bean> 
     311 
     312        <bean id="roleVoter" class="org.acegisecurity.vote.RoleVoter"> 
     313                <property name="rolePrefix"> 
     314                        <value>ROLE_</value> 
     315                </property> 
     316        </bean> 
     317        <!-- End authorization config --> 
     318 
     319        <!-- ****** END ACEGI Security Configuration *******--> 
     320 
     321        <!-- DataSource definition --> 
     322        <bean id="dataSource" 
     323                class="org.springframework.jdbc.datasource.DriverManagerDataSource"> 
     324                <property name="driverClassName"> 
     325                        <value>com.mysql.jdbc.Driver</value> 
     326                </property> 
     327                <property name="url"> 
     328                        <value>jdbc:mysql://localhost:3306/springweb_auth_db</value> 
     329                </property> 
     330                <property name="username"> 
     331                        <value>j2ee</value> 
     332                </property> 
     333                <property name="password"> 
     334                        <value>password</value> 
     335                </property> 
     336        </bean> 
     337</beans> 
     338 
     339}}}