acegi 설정

applicationContext-security-acegi.xml
<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">  
 <beans default-lazy-init="true" default-autowire="byName">  
     <bean id="channelProcessingFilter"  
              class="org.acegisecurity.securechannel.ChannelProcessingFilter">  
            <property name="channelDecisionManager">  
                <ref local="channelDecisionManager"/>    
            </property>  
            <property name="filterInvocationDefinitionSource">  
               <value>  
                   CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON   
                   PATTERN_TYPE_APACHE_ANT   
                   /j_security_check=REQUIRES_CAPTCHA_ONCE_ABOVE_THRESOLD_REQUESTS  
               </value>  
           </property>  
       </bean>  
     
       <bean id="channelDecisionManager"  
             class="org.acegisecurity.securechannel.ChannelDecisionManagerImpl">  
           <property name="channelProcessors">    
               <list>  
                   <ref local="testOnceAfterMaxRequestsCaptchaChannelProcessor"/>  
                   <ref local="alwaysTestAfterTimeInMillisCaptchaChannelProcessor"/>  
                   <ref local="alwaysTestAfterMaxRequestsCaptchaChannelProcessor"/>  
                   <ref local="alwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor"/>  
               </list>  
           </property>  
       </bean>  
     
       <!-- REQUIRES_CAPTCHA_ONCE_ABOVE_THRESOLD_REQUESTS -->  
       <bean id="testOnceAfterMaxRequestsCaptchaChannelProcessor"  
             class="org.acegisecurity.captcha.TestOnceAfterMaxRequestsCaptchaChannelProcessor">  
           <property name="thresold">  
               <value>0</value>  
           </property>  
           <property name="entryPoint">  
               <ref bean="captchaEntryPoint"/>  
           </property>  
       </bean>  
     
       <!-- REQUIRES_CAPTCHA_ABOVE_THRESOLD_REQUESTS -->  
       <bean id="alwaysTestAfterMaxRequestsCaptchaChannelProcessor"  
             class="org.acegisecurity.captcha.AlwaysTestAfterMaxRequestsCaptchaChannelProcessor">  
           <property name="thresold">  
               <value>5</value>  
           </property>  
           <property name="entryPoint">  
               <ref bean="captchaEntryPoint"/>  
           </property>  
       </bean>  
     
       <!-- REQUIRES_CAPTCHA_AFTER_THRESOLD_IN_MILLIS -->  
       <bean id="alwaysTestAfterTimeInMillisCaptchaChannelProcessor"  
             class="org.acegisecurity.captcha.AlwaysTestAfterTimeInMillisCaptchaChannelProcessor">  
           <property name="thresold">  
               <value>5000</value>  
           </property>  
           <property name="entryPoint">  
               <ref bean="captchaEntryPoint"/>  
           </property>  
       </bean>  
     
       <!-- REQUIRES_CAPTCHA_BELOW_AVERAGE_TIME_IN_MILLIS_REQUESTS -->  
       <bean  
               id="alwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor"  
               class="org.acegisecurity.captcha.AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor">  
           <property name="thresold">  
               <value>20000</value>  
           </property>  
           <property name="entryPoint">  
               <ref bean="captchaEntryPoint"/>  
           </property>  
       </bean>  
     
       <bean id="captchaEntryPoint"  
             class="org.acegisecurity.captcha.CaptchaEntryPoint">  
           <property name="captchaFormUrl">  
               <value>/login.jsp?login_error=code_error</value>  
           </property>  
           <property name="includeOriginalRequest">  
               <value>false</value>  
           </property>  
           <property name="includeOriginalParameters">  
               <value>false</value>  
           </property>  
       </bean>  
     
       <bean id="captchaValidationProcessingFilter"  
             class="org.acegisecurity.captcha.CaptchaValidationProcessingFilter">  
           <property name="captchaService">  
               <ref bean="captchaService"/>  
           </property>  
           <property name="captchaValidationParameter" value="j_captcha_response"/>  
       </bean>  
     
       <!-- imageCaptchaService is injected into captchaImageCreateController as well as to captchaService beans -->  
       <bean id="captchaService" class="com.systop.common.security.jcaptcha.JCaptchaServiceProxyImpl">  
           <property name="jcaptchaService" ref="imageCaptchaService"/>  
       </bean>  
    
      <bean id="imageCaptchaService" class="com.octo.captcha.service.image.DefaultManageableImageCaptchaService">  
          <constructor-arg type="com.octo.captcha.service.captchastore.CaptchaStore" index="0">  
              <ref bean="fastHashMapCaptchaStore"/>  
          </constructor-arg>  
          <!-- (1) which captcha Engine you use -->  
          <constructor-arg type="com.octo.captcha.engine.CaptchaEngine" index="1">  
              <ref bean="captchaEngineEx"/>  
          </constructor-arg>  
          <constructor-arg index="2">  
              <value>180</value>  
          </constructor-arg>  
          <constructor-arg index="3">  
              <value>100000</value>  
          </constructor-arg>  
          <constructor-arg index="4">  
              <value>75000</value>  
          </constructor-arg>  
      </bean>  
    
      <bean id="fastHashMapCaptchaStore" class="com.octo.captcha.service.captchastore.FastHashMapCaptchaStore"/>  
    
      <!-- (2) you can define more than one captcha engine here -->  
      <bean id="captchaEngineEx"  
            class="com.systop.common.security.jcaptcha.engine.CaptchaEngineEx"/>  
    
  </beans>  

 
applicationContext-security-captcha.xml
     <?xml version="1.0" encoding="UTF-8"?>  
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">  
    <beans default-lazy-init="true" default-autowire="byName">  
        <!-- ======================== FILTER CHAIN ======================= -->  
      
        <!--  if you wish to use channel security, add "channelProcessingFilter," in front   
            of "httpSessionContextIntegrationFilter" in the list below -->  
        <!--   
            FilterChainProxy         filter,   filter   Spring ioc   ,   
           CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON   url           
           PATTERN_TYPE_APACHE_ANT     Apache ant        
                   ,  logoutFilter   captchaValidationProcessingFilter   
               channel  , channelProcessingFilter  authenticationProcessingFilter     
       -->  
       <bean id="filterChainProxy"  
           class="org.acegisecurity.util.FilterChainProxy">  
           <property name="filterInvocationDefinitionSource">    
               <value>  
                   CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON   
                   PATTERN_TYPE_APACHE_ANT   
                   /**=httpSessionContextIntegrationFilter,logoutFilter,captchaValidationProcessingFilter,channelProcessingFilter,authenticationProcessingFilter,basicProcessingFilter,securityContextHolderAwareRequestFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor   
               </value>  
           </property>  
       </bean>  
     
       <!-- ======================== AUTHENTICATION ======================= -->  
     
       <!--   
             Providers       ,                        ,              ,    
           DaoAuthenticationProvider                   
           AnonymousAuthenticationProvider            
           RememberMeAuthenticationProvider   cookie             
              
                   
           AuthByAdapterProvider                
           CasAuthenticationProvider   Yale          ,            
           JaasAuthenticationProvider  JAAS                  
           RemoteAuthenticationProvider                
           RunAsImplAuthenticationProvider                     
           X509AuthenticationProvider  X509                
           TestingAuthenticationProvider           
              
                               , DaoAuthenticationProvider  UsernamePasswordAuthenticationToken          。   
       -->  
       <bean id="authenticationManager"  
           class="org.acegisecurity.providers.ProviderManager">  
           <property name="providers">  
               <list>  
                   <ref local="daoAuthenticationProvider" />  
                   <ref local="anonymousAuthenticationProvider" />  
                   <ref local="rememberMeAuthenticationProvider" />  
                   <!-- testingAuthenticationProvider       ,            
                       <ref local="testingAuthenticationProvider"/> -->  
               </list>  
           </property>  
           <!-- property name="sessionController">  
               <ref bean="concurrentSessionController" />  
           </property-->  
       </bean>  
     
       <!--                  web                -->  
       <bean id="concurrentSessionController"  
           class="org.acegisecurity.concurrent.ConcurrentSessionControllerImpl">  
           <property name="maximumSessions">  
               <value>1</value>  
           </property>  
           <property name="sessionRegistry">  
               <ref local="sessionRegistry" />  
           </property>  
           <property name="exceptionIfMaximumExceeded" value="true" />  
       </bean>  
     
       <bean id="sessionRegistry"  
           class="org.acegisecurity.concurrent.SessionRegistryImpl" />  
     
       <!--   
           jdbcDaoImpl             。   
           acegi            ,           。   
       -->  
       <bean id="jdbcDaoImpl" class="com.systop.common.security.acegi.UserDetailService">  
           <property name="userManager" ref="userManager"></property>    
           <!-- property name="userCache" ref="userCache"></property-->    
       </bean>  
          
       <!--                 -->  
       <bean id="userCache" class="org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache">  
           <property name="cache"><ref local="userCacheBackend"/></property>  
       </bean>  
         
       <bean id="userCacheBackend" class="org.springframework.cache.ehcache.EhCacheFactoryBean">  
          <property name="cacheManager">  
               <ref local="cacheManager"/>  
          </property>  
           <property name="cacheName">  
               <value>userCache</value>  
           </property>  
       </bean>  
         
       <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"/>  
        
      <!--   Md5     -->  
      <bean id="passwordEncoder"  
          class="org.acegisecurity.providers.encoding.Md5PasswordEncoder" />  
    
      <!--   
          userDetailsService   jdbcDaoImpl             
          userCache ehcache  user  。   
          passwordEncoder            
      -->  
      <bean id="daoAuthenticationProvider"  
          class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">  
          <property name="userDetailsService" ref="jdbcDaoImpl" />  
          <property name="userCache" ref="userCache" />  
          <property name="passwordEncoder" ref="passwordEncoder" />  
          <property name="saltSource"><null/></property>  
      </bean>  
    
    
      <!--   
          <bean id="testingAuthenticationProvider"  
          class="org.acegisecurity.providers.TestingAuthenticationProvider"/>  
      -->  
    
      <!--      AuthenticationEvent    -->  
      <bean id="loggerListener"  
          class="org.acegisecurity.event.authentication.LoggerListener" />  
    
      <!--  
              HTTP      ,  Spring    ( Hessian Burlap)        IE,Navigator HTTP          
      -->  
      <bean id="basicProcessingFilter"<

 
http://wtnhwbb.iteye.com/blog/107740

좋은 웹페이지 즐겨찾기