锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品亚洲四区在线观看,亚洲乱色伦图片区小说,亚洲精品电影天堂网http://www.tkk7.com/taochen1984/category/42649.htmlzh-cnWed, 27 Jan 2010 08:36:19 GMTWed, 27 Jan 2010 08:36:19 GMT60SpringSecurity浣跨敤璁板綍錛堝叚錛?- 鏈湴閰嶇疆浜?/title><link>http://www.tkk7.com/taochen1984/articles/310744.html</link><dc:creator>taochen</dc:creator><author>taochen</author><pubDate>Mon, 25 Jan 2010 08:29:00 GMT</pubDate><guid>http://www.tkk7.com/taochen1984/articles/310744.html</guid><wfw:comment>http://www.tkk7.com/taochen1984/comments/310744.html</wfw:comment><comments>http://www.tkk7.com/taochen1984/articles/310744.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/taochen1984/comments/commentRss/310744.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/taochen1984/services/trackbacks/310744.html</trackback:ping><description><![CDATA[鎺ョ潃鏉ャ?br /> 2.榪囨護鍣ㄧ殑閰嶇疆錛?br />   鎴戜滑宸茬粡閰嶇疆浜嗛偅浜涜繃婊ゅ櫒浜嗭紝浣嗘槸瑕佽窡spring context涓殑瀵硅薄瀵瑰簲錛屼簬鏄箮錛屽仛浜嗗涓嬮厤緗細<br />   <beans:bean id="securityContextPersistenceFilter" <br />           class="org.springframework.security.web.context.SecurityContextPersistenceFilter"><br />   </beans:bean><br />   <beans:bean id="logoutFilter" <br />           class="org.springframework.security.web.authentication.logout.LogoutFilter" ><br />           <beans:constructor-arg type="java.lang.String" value="/"/><br />           <beans:constructor-arg ref="securityContextLogoutHandler"/><br />   </beans:bean><br />   <beans:bean id="basicAuthenticationFilter" <br />           class="org.springframework.security.web.authentication.www.BasicAuthenticationFilter"><br />           <beans:property name="authenticationManager" ref="authenticationManager"></beans:property><br />           <beans:property name="authenticationEntryPoint" ref="authenticationProcessingFilterEntryPoint"></beans:property><br />   </beans:bean><br />   <beans:bean id="requestCacheAwareFilter" <br />           class="org.springframework.security.web.savedrequest.RequestCacheAwareFilter"><br />   </beans:bean><br />   <beans:bean id="securityContextHolderAwareRequestFilter" <br />           class="org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter"><br />   </beans:bean><br />   <beans:bean id="anonymousAuthenticationFilter" <br />           class="org.springframework.security.web.authentication.AnonymousAuthenticationFilter"><br />           <beans:property name="userAttribute" ref="anonymousUserAttribute"></beans:property><br />           <beans:property name="key"      value="anonymousUser"/><br />   </beans:bean><br />   <beans:bean id="sessionManagementFilter" <br />           class="org.springframework.security.web.session.SessionManagementFilter"><br />           <beans:constructor-arg  type="org.springframework.security.web.context.SecurityContextRepository" ref="sessionSecurityContextRepository"/><br />   </beans:bean><br />   <beans:bean id="exceptionTranslationFilter" <br />           class="org.springframework.security.web.access.ExceptionTranslationFilter"><br />           <beans:property name="authenticationEntryPoint" ref="authenticationProcessingFilterEntryPoint"/><br />   </beans:bean><br />   <beans:bean id="filterSecurityInterceptor" <br />           class="org.springframework.security.web.access.intercept.FilterSecurityInterceptor"><br />           <beans:property name="authenticationManager"  ref="authenticationManager" /> <br />           <beans:property name="accessDecisionManager"  ref="accessDecisionManager" /> <br />           <beans:property name="securityMetadataSource" ref="securityMetadataSource" /><br />   </beans:bean><br />   <br />   <!-- The following beans are configured for the filters upstairs --><br />   <!-- ///////////////////////////////////////// --><br />   <!-- ////for LogoutFilter///////////////////// --><br />   <!-- ///////////////////////////////////////// --><br />   <beans:bean id="securityContextLogoutHandler" <br />           class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler"><br />   </beans:bean><br />   <!-- ///////////////////////////////////////// --><br />   <!-- ////for AnonymousAuthenticationFilter//// --><br />   <!-- ///////////////////////////////////////// --><br />   <beans:bean id="anonymousUserAttribute" <br />           class="org.springframework.security.core.userdetails.memory.UserAttribute"><br />           <beans:property name="authorities"><br />             <beans:list><br />                <beans:ref  bean="anonymousUserGrantedAuthority" /><br />             </beans:list><br />           </beans:property><br />           <beans:property name="password" value="anonymousUser"/><br />   </beans:bean><br />   <beans:bean id="anonymousUserGrantedAuthority" <br />           class="org.springframework.security.core.authority.GrantedAuthorityImpl"><br />           <beans:constructor-arg type="java.lang.String" value="ROLE_ANONYMOUS"/><br />   </beans:bean><br />   <!-- ///////////////////////////////////////// --><br />   <!-- ////for SessionManagementFilter////////// --><br />   <!-- ///////////////////////////////////////// --><br />   <beans:bean id="sessionSecurityContextRepository" <br />           class="org.springframework.security.web.context.HttpSessionSecurityContextRepository"><br />   </beans:bean><br />   <!-- ///////////////////////////////////////// --><br />   <!-- ////for FilterSecurityInterceptor//////// --><br />   <!-- ///////////////////////////////////////// --><br />   <beans:bean id="accessDecisionManager" <br />           class="org.springframework.security.access.vote.AffirmativeBased"><br />           <beans:property name="decisionVoters"><br />             <beans:list><br />                <beans:ref bean="webExpressionVoter"/><br />             </beans:list><br />           </beans:property><br />   </beans:bean><br />   <beans:bean id="webExpressionVoter" <br />           class="com.saveworld.authentication.web.access.expression.MyWebExpressionVoter"><br />   </beans:bean><br />   <beans:bean id="securityMetadataSource" <br />           class="com.saveworld.authentication.web.access.intercept.MyFilterInvocationSecurityMetadataSource"><br />           <beans:constructor-arg type="org.springframework.security.web.util.UrlMatcher" ref="urlMatcher" /><br />           <beans:constructor-arg type="javax.sql.DataSource" ref="proxoolDataSource" /><br />           <beans:constructor-arg type="org.springframework.security.web.access.expression.WebSecurityExpressionHandler" <br />                                      ref="expressionHandler" /><br />   </beans:bean><br />   <beans:bean id="urlMatcher"<br />           class="org.springframework.security.web.util.AntUrlPathMatcher" ><br />           <beans:constructor-arg type="boolean" value="true" /><br />   </beans:bean><br />   <beans:bean id="expressionHandler" <br />           class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"><br />   </beans:bean><br /> 榪欓噷鍋氬嚑鐐硅鏄庯細<br />    (1) 鏁版嵁搴撲腑鐨勬潈闄愮浉鍏崇殑琛細<br />             ROLES<br />             AUTHORITIES<br />             USER_AUTHS<br />             ROLE_AUTHS<br />             USERS<br />        榪欓噷鐨勮〃緇撴瀯榪樹笉鏄渶緇堢殑錛屾墍浠ュ氨涓嶅彂涓婃潵璇鍏勫紵濮愬浠簡銆?br />        鍏抽敭鏄湅鎴戜滑濡備綍鍔犺澆榪欎簺鎸佷箙鍖栫殑涓滆タ銆?br />        榪欎釜灝辮鐪嬬湅filterSecurityInterceptor浜嗭紝瀹冮噷闈嬌鐢ㄤ簡涓涓猻ecurityMetadataSource錛屾湰鍦扮殑securityMetadataSource瀹炵幇浠g爜錛?br />       public class MyFilterInvocationSecurityMetadataSource extends DefaultFilterInvocationSecurityMetadataSource{<br />     private final static Log logger = LogFactory.getLog(ExpressionBasedFilterInvocationSecurityMetadataSource.class);<br />     private DataSource datasource;<br />     <br />     public MyFilterInvocationSecurityMetadataSource(UrlMatcher urlMatcher,<br />                                                     DataSource datasource,<br />                                                     WebSecurityExpressionHandler expressionHandler) {<br />         super(urlMatcher, processMap(initializeFromDb(datasource,null),expressionHandler.getExpressionParser()));<br />     }<br /> <br />     //This method is usefulless for now!<br />     //Because this method is used for parsing the expression kind<br />     private static LinkedHashMap<RequestKey, Collection<ConfigAttribute>> processMap(<br />             LinkedHashMap<RequestKey,Collection<ConfigAttribute>> requestMap, ExpressionParser parser) {<br />         Assert.notNull(parser, "SecurityExpressionHandler returned a null parser object");<br /> <br />         LinkedHashMap<RequestKey, Collection<ConfigAttribute>> requestToExpressionAttributesMap =<br />             new LinkedHashMap<RequestKey, Collection<ConfigAttribute>>(requestMap);<br /> <br />         for (Map.Entry<RequestKey, Collection<ConfigAttribute>> entry : requestMap.entrySet()) {<br />             RequestKey request = entry.getKey();<br />             Assert.isTrue(entry.getValue().size() == 1, "Expected a single expression attribute for " + request);<br />             ArrayList<ConfigAttribute> attributes = new ArrayList<ConfigAttribute>(1);<br />             String expression = entry.getValue().toArray(new ConfigAttribute[1])[0].getAttribute();<br />             logger.debug("Adding web access control expression '" + expression + "', for " + request);<br />             try {<br />                 //Replacing WebExpressionConfigAttribute with MyWebExpressionConfigAttribute <br />                 //which is defined locally!<br />                 attributes.add(new MyWebExpressionConfigAttribute(parser.parseExpression(expression)));<br />             } catch (ParseException e) {<br />                 throw new IllegalArgumentException("Failed to parse expression '" + expression + "'");<br />             }<br /> <br />             requestToExpressionAttributesMap.put(request, attributes);<br />         }<br /> <br />         return requestToExpressionAttributesMap;<br />     }<br /> <br />     private static LinkedHashMap<RequestKey,Collection<ConfigAttribute>> initializeFromDb(DataSource datasource,LinkedHashMap<RequestKey, Collection<ConfigAttribute>> configMap){<br />         LinkedHashMap<RequestKey,Collection<ConfigAttribute>> result = <br />             new LinkedHashMap<RequestKey, Collection<ConfigAttribute>>();<br />         Connection conn = null;<br />         Statement  stmt = null;<br />         ResultSet  rs   = null;<br />         try {<br />             conn = datasource.getConnection();<br />             stmt = conn.createStatement();<br />             StringBuilder sql = new StringBuilder("SELECT b.AUTHORITYPATTERN ,'hasRole('||chr(39)||a.ROLENAME||chr(39)||')' rolename ")<br />                                              .append(" FROM ROLES a,AUTHORITIES b,ROLE_AUTHS c ")<br />                                              .append(" WHERE a.rolename = c.rolename AND b.authorityname = c.authorityname");<br />             <br />             rs = stmt.executeQuery(sql.toString());<br />             String roles = "";<br />             RequestKey key = null;<br />             List<ConfigAttribute> value = null;<br />             while(rs != null && rs.next()){<br />                 key = new RequestKey(rs.getString(1));<br />                 roles = rs.getString(2);<br />                 String[] roleArray = roles.split(",|\\s+|;");<br />                 value = new ArrayList<ConfigAttribute>();<br />                 for(String role : roleArray){<br />                     ConfigAttribute config = new SecurityConfig(role);<br />                     value.add(config);<br />                 }<br />                 result.put(key, value);<br />             }<br />             //just for test<br />         } catch (SQLException e) {<br />             e.printStackTrace();<br />         } finally{<br />             try{<br />                 rs.close();<br />                 stmt.close();<br />                 conn.close();<br />             }catch(SQLException e){<br />                 e.printStackTrace();<br />             }<br />         }<br />         return result;<br />     }<br />     <br />     <br />     <br />     public boolean supports(Class<?> clazz) {<br />         return FilterInvocation.class.isAssignableFrom(clazz);<br />     }<br /> <br />     public DataSource getDatasource() {<br />         return datasource;<br />     }<br /> <br />     public void setDatasource(DataSource datasource) {<br />         this.datasource = datasource;<br />     }<br /> }<br />  (2) expressionHandler:<br />      榪欎釜涓滆タ瑕佸崟鐙璇達紝鎴戣繖閲岀敤鐨勬槸琛ㄨ揪寮忔潵媯嫻嬬敤鎴瘋鑹茬殑錛屾墍浠ワ紝鎴戠敤org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler鏉ュ鐞嗕簡錛岃繕鏈夊叾浠栫殑鏂瑰紡錛屽氨鏄洿鎺ョ敤瑙掕壊榪涜鍒ゆ柇錛岄偅鏍蜂細鏇村ソ錛岃繖閲屽氨涓嶆弿榪頒簡錛?br /> <br /> <br /> <img src ="http://www.tkk7.com/taochen1984/aggbug/310744.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/taochen1984/" target="_blank">taochen</a> 2010-01-25 16:29 <a href="http://www.tkk7.com/taochen1984/articles/310744.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>SpringSecurity浣跨敤璁板綍錛堝叚錛?- 鏈湴閰嶇疆涓http://www.tkk7.com/taochen1984/articles/310221.htmltaochentaochenMon, 25 Jan 2010 07:56:00 GMThttp://www.tkk7.com/taochen1984/articles/310221.htmlhttp://www.tkk7.com/taochen1984/comments/310221.htmlhttp://www.tkk7.com/taochen1984/articles/310221.html#Feedback0http://www.tkk7.com/taochen1984/comments/commentRss/310221.htmlhttp://www.tkk7.com/taochen1984/services/trackbacks/310221.html 浣嗘槸錛屾垜浠繖閲岀殑闇姹傛湁鐐硅箠璺鳳紝灝辨槸閫氳繃spring context榪涜鏉冮檺閰嶇疆澶笉鏂逛究錛屼綘鎯蟲兂鑳借浜哄瀹㈡埛閫氳繃spring xml鏉ラ厤緗潈闄愬悧錛熶笉鑳斤紝鍧氬喅涓嶈兘錛佹墍浠ワ紝鎴戝氨鍗曟璺熻釜鑾峰彇閲岄潰鐨勪笢瑗匡紙榪欑鏂規(guī)硶姣旂洿鎺ョ湅浠g爜蹇偣錛岃屼笖鍙互鐭ラ亾閲岄潰鐨勯昏緫緇撴瀯錛侊級
閭e氨寮濮嬪惂錛?br /> 1.閰嶇疆FilterChainProxy錛?br />   SpringSecurity鐨勯獙璇佽繃紼嬫槸閫氳繃涓緋誨垪鐨刦ilter鏉ュ疄鐜扮殑銆?br />   榪欑chain鐨勮璁℃ā寮忔瘮杈冪粡鍏革紝鍙互璇寸浉褰撶粡鍏革紒
  鐪嬬湅浠g爜瀹炵幇錛?br />   涓婄瘒涓榪囷紝榛樿鐨勯厤緗姹?lt;filter-name>springSecurityFilterChain</filter-name>錛岄偅榪欎釜springSecurityFilterChain鏄庝箞鏉ョ敤鐨勫憿錛?br />   public class DelegatingFilterProxy extends GenericFilterBean {
  ... ... ...
  protected void initFilterBean() throws ServletException {
        // If no target bean name specified, use filter name.
        if (this.targetBeanName == null) {
            this.targetBeanName = getFilterName();
        }

        // Fetch Spring root application context and initialize the delegate early,
        // if possible. If the root application context will be started after this
        // filter proxy, we'll have to resort to lazy initialization.
        synchronized (this.delegateMonitor) {
            WebApplicationContext wac = findWebApplicationContext();
            if (wac != null) {
                this.delegate = initDelegate(wac);
            }
        }
    }
  .....
  }
  涓嶇敤璇達紝浣犱細鐚滃埌鎴戜滑娌℃湁閰嶇疆榪噒argetBeanName榪欎釜灞炴э紝鎵浠ワ紝灝辨湁浜唗his.targetBeanName = getFilterName();榪欐牱鐨勮瘽灝變細閰嶇疆FilterChainProxy浜嗭紝鍥犱負FilterChainProxy鍦╯pringContext涓璱d鏄痵pringSecurityFilterChain錛屾墍浠ユ垜浠閫氳繃鑷繁鐨勬暟鎹簱鏂瑰紡閰嶇疆鐨勮瘽錛屽氨瑕佺悽紓ㄨ繖涓狥ilterChainProxy浜嗭紒
  鎵浠ワ紝棣栧厛鍋氱偣榪欐牱鐨勯厤緗惂錛?br />   <beans:bean id="myFilterChain" class="org.springframework.security.web.FilterChainProxy" >
      <filter-chain-map path-type="ant">
          <filter-chain pattern="/login.jsp*" filters="none"/>
          <filter-chain pattern="/**" filters="securityContextPersistenceFilter,
                                               logoutFilter,
                                               myUsernamePasswordAuthenticationFilter,
                                               basicAuthenticationFilter,
                                               requestCacheAwareFilter,
                                               securityContextHolderAwareRequestFilter,
                                               anonymousAuthenticationFilter,
                                               sessionManagementFilter,
                                               exceptionTranslationFilter,
                                               filterSecurityInterceptor"/>
      </filter-chain-map>
  </beans:bean>
榪欎釜閲岄潰閰嶇疆鐨刬d涓簃yFilterChain錛屾墍浠ヨ鍦╳eb.xml閲岄潰鍋氱浉搴旈厤緗細
   <filter>
      <filter-name>myFilterChain</filter-name>
      <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
  </filter>
  <filter-mapping>
      <filter-name>myFilterChain</filter-name>
      <url-pattern>/*</url-pattern>
  </filter-mapping>
鑰屼笖錛屽挨涓洪噸瑕佺殑鏄閰嶇疆涓婅繖浜涜繃婊ゅ櫒錛?br /> filter-chain pattern="/**" filters="securityContextPersistenceFilter,logoutFilter,
                                               myUsernamePasswordAuthenticationFilter,
                                               basicAuthenticationFilter,
                                               requestCacheAwareFilter,
                                               securityContextHolderAwareRequestFilter,
                                               anonymousAuthenticationFilter,
                                               sessionManagementFilter,
                                               exceptionTranslationFilter,
                                               filterSecurityInterceptor"
閽堝榪欎簺榪囨護鍣ㄧ殑鐢ㄩ旓紝鍦╯pring security鐨勬枃妗d腑鏈夎緇嗘弿榪幫紝榪欓噷涓嶅璇翠簡錛屽湪鏂囨。涓殑鍏蜂綋浣嶇疆鏄?.2 FilterChainProxy錛岀湅鐪嬭繖涓绔犲氨浼氭湁鎰熻浜嗭紝涓嶈繃緇濈煡姝や簨瑕佽含琛屽晩錛?br /> 瀹屾垚榪欎簺閰嶇疆涔嬪悗錛屾垜浠氨綆楁槸鎶婂叆鍙g粰鎼緩濂戒簡錛?br /> 閴翠簬鏂囨。綃囧箙錛屾崲鍒頒笅綃囨帴鐫璇淬?br />


taochen 2010-01-25 15:56 鍙戣〃璇勮
]]>
SpringSecurity浣跨敤璁板綍錛堜簲錛?- 閰嶇疆http://www.tkk7.com/taochen1984/articles/310072.htmltaochentaochenTue, 19 Jan 2010 06:19:00 GMThttp://www.tkk7.com/taochen1984/articles/310072.htmlhttp://www.tkk7.com/taochen1984/comments/310072.htmlhttp://www.tkk7.com/taochen1984/articles/310072.html#Feedback0http://www.tkk7.com/taochen1984/comments/commentRss/310072.htmlhttp://www.tkk7.com/taochen1984/services/trackbacks/310072.html 緇堜簬錛屽湪鏃犳暟嬈$殑娌撫涓嬶紝紼嶅井鐪嬪埌浜嗙偣鍏変寒錛佸墠闈㈢殑鏂囩珷澶繃鐨瘺錛屾帴涓嬫潵鐨勪竴浜涳紝甯屾湜鑳芥洿鍔犲疄闄呯殑錛屾洿鍔犳繁鍏ョ殑鍒嗘瀽姣忎竴涓繃紼嬶紒

涓鐩撮氳繃榛樿閰嶇疆榪涜璁劇疆錛?br /> namespace(鏄痵ecurity 3.0,緗戜笂涔熺湅鍒頒竴浜涘厔寮熸弿榪扮殑鏄?.0錛屼絾鏄繪槸涓嶇鍚堟垜榪欓噷鐨刵amespace閰嶇疆):
<beans:beans xmlns="http://www.springframework.org/schema/security"
           xmlns:beans="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           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">
鎸夌収榛樿閰嶇疆鐨刪ttp錛堣繖鏄敤鏉ユ牴鎹畁amespace璁劇疆鐨勫熀鏈殑security榪囨護鍣╟hain錛夛細
auto-config=true鏃訛紝灝辯浉褰撲簬
  <http>
    <form-login />
    <http-basic />
    <logout />
  </http>
涔熷氨鏄嬌鐢ㄤ簡榛樿鐨勮繃婊ゅ櫒銆?br /> 鎴戞渶寮濮嬬殑鎯蟲硶鏄兘澶熸妸鏈湴鐨刲ogin淇℃伅錛堜笉鏄皟鐢╯pring security鐨刲ogin鏂規(guī)硶錛夛紝浼犲叆鍒皊pring security鐨勯獙璇佽繃婊ゅ櫒閲岄潰銆?br /> 榪欓噷鏈変竴涓瘮杈冨叧閿殑闂錛屽氨鏄皝瑁呬粬浠殑榪囨護鍣紙鎴栬呬粎浠呮槸鐭ラ亾浠栦滑鍒板簳鏄摢浜涜繃婊ゅ櫒鍦ㄨ搗浣滅敤錛夛細
琛?
AliasFilter ClassNamespace Element or Attribute
CHANNEL_FILTER ChannelProcessingFilter http/intercept-url@requires-channel
CONCURRENT_SESSION_FILTER ConcurrentSessionFilter session-management/concurrency-control
SECURITY_CONTEXT_FILTER SecurityContextPersistenceFilter http
LOGOUT_FILTER LogoutFilter http/logout
X509_FILTER X509AuthenticationFilter http/x509
PRE_AUTH_FILTER AstractPreAuthenticatedProcessingFilter Subclasses N/A
CAS_FILTER CasAuthenticationFilter N/A
FORM_LOGIN_FILTER UsernamePasswordAuthenticationFilter http/form-login
BASIC_AUTH_FILTER BasicAuthenticationFilter http/http-basic
SERVLET_API_SUPPORT_FILTER SecurityContextHolderAwareFilter http/@servlet-api-provision
REMEMBER_ME_FILTER RememberMeAuthenticationFilter http/remember-me
ANONYMOUS_FILTER AnonymousAuthenticationFilter http/anonymous
SESSION_MANAGEMENT_FILTER SessionManagementFilter session-management
EXCEPTION_TRANSLATION_FILTER ExceptionTranslationFilter http
FILTER_SECURITY_INTERCEPTOR FilterSecurityInterceptor http
SWITCH_USER_FILTER SwitchUserFilter N/A


錛堟渶寮濮嬬湅鐨勬椂鍊欙紝鎶婅繖涓〃鏍煎拷鐣ヤ簡錛岀幇鍦ㄧ湅鏉ヨ繖浜涘氨鏄垜浠兂瑕佺殑錛侊級
鎴戜滑鐨勯獙璇佽繃紼嬶紝灝辨槸鎸夌収榪欐牱鐨勯『搴忚繘琛岀殑銆傝嚜涓婅屼笅榪涜銆?br />
濡傛灉鎴戜滑瑕佽嚜宸卞畾鍒剁浉搴旂殑楠岃瘉澶勭悊鏂規(guī)硶錛堝湪榪囨護鍣ㄩ噷闈級錛屾垜浠氨鍙互瀵圭収涓婇潰鐨勮繃婊ゅ櫒錛岃鐩栫浉搴旂殑鎺ュ彛鏂規(guī)硶銆?br /> 鏍規(guī)嵁鎴戠殑澶勭悊榪囩▼錛屼富瑕佹槸鐢ㄦ埛鍚嶅瘑鐮佺殑楠岃瘉榪囩▼錛屾垜澶т綋鎻忚堪涓涓嬭嚜宸辯殑閰嶇疆鍜屽鐞嗚繃紼嬶細
1.閰嶇疆namespace鐨勬爣絳?
  <http  use-expressions="true" ><!-- This is not the default value -->
       <custom-filter position="FORM_LOGIN_FILTER" ref="myFilter"/> <!--This is my own filter which just extends AbstractAuthenticationProcessingFilter as what UsernamePasswordAuthenticationFilter does.-->
       <intercept-url pattern="/test/**"  access="hasRole('ROLE_MY')"/><!-- I tested that what is role,and how I can use it.So ROLE_MY is just a role name I defined.-->
       <intercept-url pattern="/login.jsp*" access="permitAll" />
       <logout />
       <anonymous />
       <http-basic />
  </http>
榪欓噷鐨勯棶棰樻槸錛岃瀹氬埗鑷繁鐨勮繃婊ゅ櫒錛屽氨瑕侀氳繃<custom-filter/>錛岀劧鍚庡鐓?琛? 涓寚瀹氱殑position,瑕嗙洊榛樿鐨刦ilter銆?br /> 2.鎴戠殑form-login  filter閰嶇疆錛堣繖浜涢厤緗兘鏄湪application-security.xml鏂囦歡涓級涓猴細
<beans:bean id="myFilter"
      class="com.saveworld.authentication.filters.MyUsernamePasswordAuthenticationFilter">
    <beans:property name="defaultTargetUrl"  value="/default.jsp" />
    <beans:property name="defaultFailureUrl"  value="/error.jsp" />
    <beans:property name="authenticationManager" ref="authenticationManager" />
    <beans:property name="filterProcessesUrl" value="/j_spring_security_check" />
    <beans:property name="continueChainBeforeSuccessfulAuthentication" value="false" />
  </beans:bean>

NOTE錛?br /> 鍦ㄨ繖閲屾湁涓棶棰樺氨鏄細 filter position conflicts!
濡傛灉浣跨敤榪欐牱鐨勯厤緗?br /> <http auto-config='true'>
   <custom-filter position="FORM_LOGIN_FILTER" ref="myFilter"/>
</http>
鑷畾涔夌殑filter瀵瑰簲鐨刾osition鏄疐ORM_LOGIN_FILTER
浣嗘槸鍥犱負浣跨敤浜哸uto-config='true'錛屾墍浠ラ粯璁ゆ湁<form-login />錛寃hich is on the position FORM_LOGIN_FILTER!
榪欐椂灝變細鍑虹幇position conflicts闂浜嗐傚綋鐒訛紝濡傛灉浣犳病鏈夎緗產(chǎn)uto-config='true'錛屼絾鏄嵈鑷繁璁劇疆浜?lt;form-login />錛屽懙鍛碉紝榪欎釜鎯呭喌灝辨槸鑷繁澶ф剰浜嗭紝榪樻槸鏈変簡position conflicts鐨勫紓甯革紝鎵浠ワ紝濂藉ソ鐪嬬湅涓婇潰鐨勮〃鏍兼槸鐩稿綋蹇呰鐨勶紝鐪嬫竻妤氭瘡涓猵osition榛樿閮藉搴旈偅浜沶amespace錛岄兘鏄搴旂殑鍝簺filter錛?br />
鎺ョ潃錛?br /> 鎴戠殑綾籑yUsernamePasswordAuthenticationFilter瀹炵幇錛堟垜鐨勮鏄庢柟寮忓氨鎸夌収鍝噷闇瑕侊紝鍝噷鍔犲叆鐨勬柟寮忎簡錛夛細
package com.saveworld.authentication.filters;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.event.InteractiveAuthenticationSuccessEvent;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.security.web.authentication.NullRememberMeServices;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
import org.springframework.security.web.util.TextEscapeUtils;
import org.springframework.util.Assert;

import com.saveworld.authentication.handlers.MySavedRequestAwareAuthenticationSuccessHandler;
import com.saveworld.authentication.handlers.MySimpleUrlAuthenticationFailureHandler;

public class MyUsernamePasswordAuthenticationFilter extends AbstractAuthenticationProcessingFilter{
    //~ Static fields/initializers =====================================================================================

    public static final String SPRING_SECURITY_FORM_USERNAME_KEY = "username";
    public static final String SPRING_SECURITY_FORM_PASSWORD_KEY = "password";
    public static final String SPRING_SECURITY_LAST_USERNAME_KEY = "SPRING_SECURITY_LAST_USERNAME";

    private String usernameParameter = SPRING_SECURITY_FORM_USERNAME_KEY;
    private String passwordParameter = SPRING_SECURITY_FORM_PASSWORD_KEY;
    private boolean postOnly = true;
   
    private boolean allowSessionCreation = true;
   
    private String defaultTargetUrl = "/";
    private String defaultFailureUrl = "/login.jsp";
   
    private AuthenticationSuccessHandler successHandler = null;
    private AuthenticationFailureHandler failureHandler = null;
   
   
    private RememberMeServices rememberMeServices = null;
   
    //~ Constructors ===================================================================================================

    public MyUsernamePasswordAuthenticationFilter() {
        //鍒濆鍖?br />         super("/j_spring_security_check");
        this.rememberMeServices = (super.getRememberMeServices() == null)
                                     ? new NullRememberMeServices():super.getRememberMeServices();
       
    }

    //~ Methods ========================================================================================================

    public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
        if (postOnly && !request.getMethod().equals("POST")) {
            throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod());
        }

        String username = obtainUsername(request);
        String password = obtainPassword(request);

        if (username == null) {
            username = "";
        }

        if (password == null) {
            password = "";
        }

        username = username.trim();

        UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password);

        // Place the last username attempted into HttpSession for views
        HttpSession session = request.getSession(false);

        if (session != null || getAllowSessionCreation()) {
            request.getSession().setAttribute(SPRING_SECURITY_LAST_USERNAME_KEY, TextEscapeUtils.escapeEntities(username));
        }

        // Allow subclasses to set the "details" property
        setDetails(request, authRequest);

        return this.getAuthenticationManager().authenticate(authRequest);
    }

   
   
    public void successfulAuthentication(HttpServletRequest request, HttpServletResponse response,
            Authentication authResult) throws IOException, ServletException {

        if (logger.isDebugEnabled()) {
            logger.debug("Authentication success. Updating SecurityContextHolder to contain: " + authResult);
        }
       
        SecurityContextHolder.getContext().setAuthentication(authResult);

        rememberMeServices.loginSuccess(request, response, authResult);

        // Fire event
        if (this.eventPublisher != null) {
            eventPublisher.publishEvent(new InteractiveAuthenticationSuccessEvent(authResult, this.getClass()));
        }
        if(successHandler == null){
            successHandler = new MySavedRequestAwareAuthenticationSuccessHandler(getDefaultTargetUrl());
        }
        successHandler.onAuthenticationSuccess(request, response, authResult);
    }
   
    public void unsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response,
            AuthenticationException failed) throws IOException, ServletException {
        SecurityContextHolder.clearContext();
       
        if(failureHandler == null){
            failureHandler = new MySimpleUrlAuthenticationFailureHandler(getDefaultFailureUrl());
        }
       
        if (logger.isDebugEnabled()) {
            logger.debug("Authentication request failed: " + failed.toString());
            logger.debug("Updated SecurityContextHolder to contain null Authentication");
            logger.debug("Delegating to authentication failure handler" + failureHandler);
        }

        HttpSession session = request.getSession(false);

        if (session != null || allowSessionCreation) {
            request.getSession().setAttribute(SPRING_SECURITY_LAST_EXCEPTION_KEY, failed);
        }

        rememberMeServices.loginFail(request, response);

        failureHandler.onAuthenticationFailure(request, response, failed);
    }
   
   
    /**
     * Enables subclasses to override the composition of the password, such as by including additional values
     * and a separator.<p>This might be used for example if a postcode/zipcode was required in addition to the
     * password. A delimiter such as a pipe (|) should be used to separate the password and extended value(s). The
     * <code>AuthenticationDao</code> will need to generate the expected password in a corresponding manner.</p>
     *
     * @param request so that request attributes can be retrieved
     *
     * @return the password that will be presented in the <code>Authentication</code> request token to the
     *         <code>AuthenticationManager</code>
     */
    protected String obtainPassword(HttpServletRequest request) {
        return request.getParameter(passwordParameter);
    }

    /**
     * Enables subclasses to override the composition of the username, such as by including additional values
     * and a separator.
     *
     * @param request so that request attributes can be retrieved
     *
     * @return the username that will be presented in the <code>Authentication</code> request token to the
     *         <code>AuthenticationManager</code>
     */
    protected String obtainUsername(HttpServletRequest request) {
        return request.getParameter(usernameParameter);
    }

    /**
     * Provided so that subclasses may configure what is put into the authentication request's details
     * property.
     *
     * @param request that an authentication request is being created for
     * @param authRequest the authentication request object that should have its details set
     */
    protected void setDetails(HttpServletRequest request, UsernamePasswordAuthenticationToken authRequest) {
        authRequest.setDetails(authenticationDetailsSource.buildDetails(request));
    }

    /**
     * Sets the parameter name which will be used to obtain the username from the login request.
     *
     * @param usernameParameter the parameter name. Defaults to "j_username".
     */
    public void setUsernameParameter(String usernameParameter) {
        Assert.hasText(usernameParameter, "Username parameter must not be empty or null");
        this.usernameParameter = usernameParameter;
    }

    /**
     * Sets the parameter name which will be used to obtain the password from the login request..
     *
     * @param passwordParameter the parameter name. Defaults to "j_password".
     */
    public void setPasswordParameter(String passwordParameter) {
        Assert.hasText(passwordParameter, "Password parameter must not be empty or null");
        this.passwordParameter = passwordParameter;
    }

    /**
     * Defines whether only HTTP POST requests will be allowed by this filter.
     * If set to true, and an authentication request is received which is not a POST request, an exception will
     * be raised immediately and authentication will not be attempted. The <tt>unsuccessfulAuthentication()</tt> method
     * will be called as if handling a failed authentication.
     * <p>
     * Defaults to <tt>true</tt> but may be overridden by subclasses.
     */
    public void setPostOnly(boolean postOnly) {
        this.postOnly = postOnly;
    }

    public final String getUsernameParameter() {
        return usernameParameter;
    }

    public final String getPasswordParameter() {
        return passwordParameter;
    }

    public String getDefaultTargetUrl() {
        return defaultTargetUrl;
    }

    public void setDefaultTargetUrl(String defaultTargetUrl) {
        this.defaultTargetUrl = defaultTargetUrl;
    }

    public String getDefaultFailureUrl() {
        return defaultFailureUrl;
    }

    public void setDefaultFailureUrl(String defaultFailureUrl) {
        this.defaultFailureUrl = defaultFailureUrl;
    }
   
   
}

榪欓噷瑕佸叧娉ㄧ殑灝辨槸鍑犱釜瀛楁錛?br />     <beans:property name="defaultTargetUrl"  value="/default.jsp" />
    <beans:property name="defaultFailureUrl"  value="/error.jsp" />
榪欎袱涓瓧孌墊槸鎸囧畾楠岃瘉鎴愬姛鎴栧け璐ュ悗杞悜鐨勯〉闈紝榪欓噷瑕佹敞鎰忔槸浠?#8220;/”寮澶達紝鍚﹀垯鍦ˋbstractAuthenticationTargetUrlRequestHandler涓皟鐢╯etDefaultTargetUrl鏂規(guī)硶鏃朵細鎶涘嚭"defaultTarget must start with '/' or with 'http(s)'"鐨勫紓甯革紒
榛樿鎯呭喌涓嬶紝FORM_LOGIN_FILTER瀵瑰簲鐨則arget url鍜宖ailure url閮芥槸閫氳繃 <form-login />涓殑default-target-url,authentication-failure-url鎸囧畾錛屼篃鍙互閫氳繃鎸囧畾authentication-success-handler-ref鍜?/strong>authentication-failure-handler-ref鏉ュ疄鐜拌璇佹垚鍔熷拰澶辮觸涔嬪悗鐨勫鐞嗘柟寮?鍦ㄦ垜鐨刦ilter涓紝鏄嚜瀹氫箟浜嗕袱涓猦andler鍒嗗埆瀵瑰簲鎴愬姛鐨勫拰澶辮觸鐨勯獙璇併?br />
3.鐢ㄦ埛淇℃伅鑾峰彇鍜岄獙璇侊細
  <authentication-manager alias="authenticationManager">
    <authentication-provider user-service-ref='myUserDetailsService'/>
  </authentication-manager>
  <beans:bean id="myUserDetailsService" class="com.saveworld.userdetails.MyUserDetailsService"></beans:bean>
榪欎釜鎸囧畾鐨刟uthentication-manager鏄嬌鐢ㄩ粯璁ょ殑ProviderManager錛岃繖涓猰anager鏄湪鍝噷浣跨敤鐨勫憿錛?br /> 鐪嬬湅MyUsernamePasswordAuthenticationFilter涓殑attemptAuthentication鏂規(guī)硶鐨勬渶鍚庝竴琛岋紝榪欓噷鏄幏鍙栨寚瀹氱殑authentication-manager銆俫etAuthenticationManager鏄粠鐖剁被AbstractAuthenticationProcessingFilter緇ф壙榪囨潵鐨勩傛墍浠ワ紝鎴戜滑鐨?lt;authentication-manager alias="authenticationManager">涓氨鎸囧畾浜嗕竴涓埆鍚峚uthenticationManager錛屽湪myfilter涓緗睘鎬х殑寮曠敤<beans:property name="authenticationManager" ref="authenticationManager" />錛岀劧鍚庢垜浠氨鍙互閫氳繃Provider寮曠敤鎴戜滑鑷繁鐨勭敤鎴蜂俊鎭獙璇乻ervice浜嗭紙eg:鐢ㄦ埛淇℃伅鑾峰彇鍜岄獙璇侊級錛佽繖閲屽疄闄呮槸浣跨敤浜哅ethod Template妯″紡錛圓bstractAuthenticationManager涓瀹氭ā鏉垮嚱鏁癲oAuthentication錛孭roviderManager涓仛浜嗗疄鐜幫級銆?br /> 榪欓噷闅懼厤瑕佽鏄庝竴涓嬶紝鎴戜滑鐨凷ervice鏄浣曡璋冪敤鐨勶紝鎴戜滑鍋氫簡閰嶇疆<authentication-provider user-service-ref='myUserDetailsService'/>
鎸囧畾浜嗘垜浠殑UserDetailsService錛岀被瀹炵幇(涓轟簡嫻嬭瘯鍜岀悊瑙o紝The easier the better!)錛?br /> package com.saveworld.userdetails;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.GrantedAuthorityImpl;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

public class MyUserDetailsService implements UserDetailsService{
   
    private HashMap<String, User> userDetails = new HashMap<String, User>();
    private HashMap<String, List<GrantedAuthority>> userAuthorities = new HashMap<String, List<GrantedAuthority>>();
   
    public MyUserDetailsService(){
        //Make up a user named 'rod' with 'rod' as his password!
        //
        String username = "rod";
        String password = "1";
        boolean enabled = true;
        //purview for rod
        GrantedAuthority specAuth = new GrantedAuthorityImpl("ROLE_MY");
        List<GrantedAuthority> rodsAuthsList = new ArrayList<GrantedAuthority>();
        rodsAuthsList.add(specAuth);
//        userAuthorities.put("rod", rodsAuthsList);
        userDetails.put("rod", new User(username, password, enabled, true, true, true, rodsAuthsList));
    }
   
   
    public UserDetails loadUserByUsername(String username)
            throws UsernameNotFoundException, DataAccessException {
        System.out.println("楠岃瘉浠庢鍦拌繃浜嗕竴閬?);
        return userDetails.get(username);
    }

}
閫氳繃DaoAuthenticationProvider涓殑userDetailsService鍏寵仈鎴戜滑鐨刄serDetailsService錛堜笉寰椾笉鎻愮殑鏄紝AbstractUserDetailsAuthenticationProvider涓湁璁懼畾浜嗘ā鏉垮嚱鏁皉etrieveUser錛孌aoAuthenticationProvider榪涜浜嗗疄鐜幫紝閫氳繃retrieveUser鏂規(guī)硶璋冪敤UserDetailsService.loadUserByUsername錛岀劧鍚庡湪AbstractUserDetailsAuthenticationProvider.authenticate鏂規(guī)硶榪涜楠岃瘉錛夈?br /> 鎺ヤ笅鏉ュ氨鏄湅楠岃瘉鐨勭粨鏋滀簡錛屾槸鍚︽垚鍔燂紝榪涘叆filter chain涓?br /> 榪欎竴鍒囧氨榪欎箞鏈夋潯涓嶇磰鐨勮繘琛屼簡錛佸懙鍛碉紝鎬葷畻鏄湁鐐規(guī)垚鏋滀簡錛佹湁浜嗕竴鐐圭偣鎰熸х殑璁よ瘑浜嗭紒涓婇潰鐨勬弿榪頒腑闅懼厤浼氭湁浜涙販涔憋紝浣嗘槸灝介噺鏄摢閲岄渶瑕侊紝鍝噷灝卞仛璇存槑錛?br />
涓嬬瘒涓鏄巈ntrypoint鐨勭敤澶勫惂錛?br />

taochen 2010-01-19 14:19 鍙戣〃璇勮
]]>
SpringSecurity浣跨敤璁板綍錛堜簩錛?-鏍稿績鍒嗘瀽綃?/title><link>http://www.tkk7.com/taochen1984/articles/307275.html</link><dc:creator>taochen</dc:creator><author>taochen</author><pubDate>Fri, 25 Dec 2009 07:53:00 GMT</pubDate><guid>http://www.tkk7.com/taochen1984/articles/307275.html</guid><wfw:comment>http://www.tkk7.com/taochen1984/comments/307275.html</wfw:comment><comments>http://www.tkk7.com/taochen1984/articles/307275.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/taochen1984/comments/commentRss/307275.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/taochen1984/services/trackbacks/307275.html</trackback:ping><description><![CDATA[涓嶅緱涓嶅啀鎰熷徆涓涓嬶紝絳栫暐妯″紡鍦⊿pringSecurity涓敤鐨勫湴鏂瑰お澶氫簡錛?br /> <br /> ? SecurityContextHolder, to provide access to the SecurityContext.<br /> ? SecurityContext,  to  hold  the  Authentication  and  possibly  request-specific  security<br /> information.<br /> ? Authentication, to represent the principal in a Spring Security-specific manner.<br /> ? GrantedAuthority, to reflect the application-wide permissions granted to a principal.<br /> ? UserDetails, to provide the necessary information to build an Authentication object from your<br /> application's DAOs or other source source of security data.<br /> ? UserDetailsService, to create a UserDetails when passed in a String-based username<br /> (or certificate ID or the like).<br /> 錛堜互涓婃槸浠庢枃妗i噷闈㈡妱鍑烘潵鐨勶紒錛?br /> 榪欏氨鏄潈闄愮殑鏍稿績浜嗭紒錛侊紙鎸佺畫淇敼涓傘傘傘傘傘傦級<br /> <img src ="http://www.tkk7.com/taochen1984/aggbug/307275.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/taochen1984/" target="_blank">taochen</a> 2009-12-25 15:53 <a href="http://www.tkk7.com/taochen1984/articles/307275.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>SpringSecurity浣跨敤璁板綍錛堜竴錛?/title><link>http://www.tkk7.com/taochen1984/articles/307203.html</link><dc:creator>taochen</dc:creator><author>taochen</author><pubDate>Thu, 24 Dec 2009 12:05:00 GMT</pubDate><guid>http://www.tkk7.com/taochen1984/articles/307203.html</guid><wfw:comment>http://www.tkk7.com/taochen1984/comments/307203.html</wfw:comment><comments>http://www.tkk7.com/taochen1984/articles/307203.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/taochen1984/comments/commentRss/307203.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/taochen1984/services/trackbacks/307203.html</trackback:ping><description><![CDATA[絎竴嬈¢厤緗拰浣跨敤SpringSecurity錛屾繪槸瑕佺寰堝嬈″錛?br /> 鍏堣璇翠釜浜虹悊瑙g殑瀹冮噷闈㈡瘮杈冩湁鎰忎箟鐨勬灦鏋勩?br /> 閲岄潰鏈夊ソ澶氳璁℃ā寮忕殑褰卞瓙錛氱瓥鐣ユā寮忥紝浠g悊妯″紡錛屽伐鍘傛ā寮忥紝閾炬潯妯″紡=====錛岀湅鍒拌繖浜涙ā寮忥紙闄や簡宸ュ巶鎴栧崟渚嬶級蹇冮噷鎬繪槸浼氭湁浜涘叴濂嬶紝鎬葷畻鏄湅鍒頒簡妯″紡鐨勭湡姝g粌鍏靛満錛佽窡鍏勫紵浠ソ濂藉垎浜竴涓?(鎵嶇湅浜嗕竴澶╋紒鏈変笉瀵逛箣澶勶紝榪樻湜鍚勪綅鏂ф錛?<br /> 絳栫暐妯″紡錛圫trategy Pattern錛?<br /> 涓昏璇翠竴涓媠ession鐩稿叧鐨勮繖涓瓥鐣ユā寮忥紝浠essionAuthenticationStrategy鎺ュ彛鐨勭瓥鐣ュ垝鍒嗭紝鏍規(guī)嵁鎴戜滑鐨剆ession瀹夊叏絳栫暐錛屾寚瀹氫笉鍚岀殑絳栫暐錛岀幇鍦ㄧ湅鏄繖縐嶅竷灞錛?br /> <table border="0" cellpadding="2" cellspacing="2" width="853" height="280"> <tbody> <tr> <td> 欏跺眰鎺ュ彛</td> <td> SessionAuthenticationStrategy</td> <td> </td> <td> </td> </tr> <tr> <td> 鍏蜂綋瀹炵幇</td> <td> SessionFixationProtectionStrategy<br /> 錛堢洿鎺ラ粯璁ゅ疄鐜幫級</td> <td> NullAuthenticatedSessionStrategy<br /> 錛堢┖瀹炵幇錛?br /> </td> <td> </td> </tr> <tr> <td> 浜岀駭瀹炵幇</td> <td> ConcurrentSessionControlStrategy</td> <td> </td> <td> </td> </tr> </tbody> </table> <br /> 鐢誨浘姣旇緝楹葷儲錛屽悇浣嶈繕鏄噾鍚堢潃鐪嬪惂錛佽鏄庝竴涓嬶細欏跺眰鎺ュ彛琚笅闈?#8220;鍏蜂綋瀹炵幇”涓や釜綾誨疄鐜幫紝鑰?#8220;浜岀駭瀹炵幇”瀹炵幇SessionFixationProtectionStrategy銆傚叿浣撻噰鐢ㄥ摢縐嶇瓥鐣ヨ鐪嬫垜浠殑閰嶇疆浜嗭紒<br /> 浠g悊妯″紡錛圥roxy錛夛細<br /> 寰堟槑鏄劇殑浠g悊綾伙紝DelegatingFilterProxy鍜孎ilterChainProxy錛岃繖涓や釜綾葷湅鐫蹇冮噷閮界棐鐥掔殑錛屽懙鍛碉紝騫沖父鎬繪槸鐪嬩唬鐞嗘ā寮忓憖浠涔堢殑錛屽嵆鏃剁湅鐫渚嬪瓙涔熶笉韙忓疄錛岀幇鍦ㄧ湅鍒拌繖涓や釜涓滆タ錛屽績閲岀獊鐒舵湁縐嶅鉤闈欑殑嬋鍔紒<br /> 榪欎袱涓唬鐞嗙被浠ilterChainProxy涓轟緥璇存槑涓涓嬪惂錛孎ilterChainProxy浠g悊浜嗘潈闄愰獙璇丗ilters鐨勫伐浣滐紝閫氳繃瀹冩潵璁塊棶鏁翠釜榪囨護鍣ㄤ覆閲岄潰鐨勮繃婊ゅ櫒銆?br /> Chain妯″紡錛氳繖涓篃搴旇浠ilterChainProxy榪欎釜綾誨叆鍙f潵鍒嗘瀽錛屽懙鍛碉紝鏈夊叴瓚g殑鍚勪綅灝遍氳繃榪欎釜鏉ョ湅鐪嬪惂錛?br /> <img src ="http://www.tkk7.com/taochen1984/aggbug/307203.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/taochen1984/" target="_blank">taochen</a> 2009-12-24 20:05 <a href="http://www.tkk7.com/taochen1984/articles/307203.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://qqc46.com" target="_blank">GOGOGO免费观看国语</a>| <a href="http://15831883389.com" target="_blank">伊人久久免费视频</a>| <a href="http://zzhdrsqwx.com" target="_blank">久久久久久a亚洲欧洲aⅴ</a>| <a href="http://7x966.com" target="_blank">久久久久免费看黄a级试看</a>| <a href="http://9aiba.com" target="_blank">亚洲天堂福利视频</a>| <a href="http://www-741.com" target="_blank">免费永久国产在线视频</a>| <a href="http://www6661126.com" target="_blank">日韩免费高清播放器</a>| <a href="http://www4jbd.com" target="_blank">亚洲人成影院在线高清</a>| <a href="http://24aabb.com" target="_blank">无码欧精品亚洲日韩一区夜夜嗨</a>| <a href="http://qihongxia.com" target="_blank">91免费在线视频</a>| <a href="http://jx-dirui.com" target="_blank">亚洲一级黄色大片</a>| <a href="http://326h.com" target="_blank">亚洲人成人无码网www国产</a>| <a href="http://3c3w.com" target="_blank">亚洲香蕉免费有线视频</a>| <a href="http://0939666.com" target="_blank">妇女自拍偷自拍亚洲精品</a>| <a href="http://740740740.com" target="_blank">亚洲s色大片在线观看</a>| <a href="http://hs718.com" target="_blank">暖暖免费高清日本中文</a>| <a href="http://sdyzzs.com" target="_blank">毛片免费在线观看</a>| <a href="http://ryhjled.com" target="_blank">亚洲av日韩专区在线观看</a>| <a href="http://www-887234.com" target="_blank">久久精品国产99精品国产亚洲性色</a>| <a href="http://yuejiju.com" target="_blank">最近免费中文字幕大全视频</a>| <a href="http://449892.com" target="_blank">天堂在线免费观看</a>| <a href="http://meixiudashi.com" target="_blank">亚洲日本在线电影</a>| <a href="http://wangquanai.com" target="_blank">亚洲综合国产精品</a>| <a href="http://jmdehong.com" target="_blank">亚洲一区二区精品视频</a>| <a href="http://jte-sh.com" target="_blank">成人特黄a级毛片免费视频</a>| <a href="http://www-36664.com" target="_blank">中国一级特黄的片子免费 </a>| <a href="http://51a88.com" target="_blank">亚洲妓女综合网99</a>| <a href="http://179228.com" target="_blank">久久亚洲高清综合</a>| <a href="http://iguasheng.com" target="_blank">免费观看成人毛片a片2008</a>| <a href="http://jioupin.com" target="_blank">国产免费一区二区视频</a>| <a href="http://1877808.com" target="_blank">偷自拍亚洲视频在线观看</a>| <a href="http://jogador1.com" target="_blank">亚洲精品国产情侣av在线</a>| <a href="http://0149545.com" target="_blank">狠狠亚洲狠狠欧洲2019</a>| <a href="http://9196528.com" target="_blank">韩国免费三片在线视频</a>| <a href="http://bwgdbjb.com" target="_blank">aⅴ在线免费观看</a>| <a href="http://zcrencai.com" target="_blank">AAA日本高清在线播放免费观看</a>| <a href="http://gbn21.com" target="_blank">亚洲aⅴ天堂av天堂无码麻豆</a>| <a href="http://yiqigxfc.com" target="_blank">亚洲精品国产第1页</a>| <a href="http://www-2236444.com" target="_blank">亚洲精品无码精品mV在线观看</a>| <a href="http://5222133.com" target="_blank">国产精品酒店视频免费看</a>| <a href="http://91xqq.com" target="_blank">一二三四免费观看在线电影</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>