最近要用到權限控制,查閱了一些資料。看到一些比較好的東西,又助於理解。
<!-- 1.URL過濾器或方法攔截器:用來攔截URL或者方法資源對其進行驗證,其抽象基類爲AbstractSecurityInterceptor
2.資源權限獲取器:用來取得訪問某個URL或者方法所需要的權限,接口爲SecurityMetadataSource
3.訪問決策器:用來決定用戶是否擁有訪問權限的關鍵類,其接口爲AccessDecisionManager
調用順序爲:
AbstractSecurityInterceptor調用SecurityMetadataSource取得資源的所有可訪問權限,
然後再調用AccessDecisionManager來實現決策,
確定用戶是否有權限訪問該資源。 -->
<!-- 自定義的filter, 必須包含authenticationManager, accessDecisionManager, securityMetadataSource三個屬性 -->
<beans:bean id="mySecurityFilter" class="com.xa3ti.lishixiangmu.base.security.XaFilterSecurityInterceptor">
<beans:property name="authenticationManager" ref="myAuthenticationManager" />
<beans:property name="accessDecisionManager" ref="myAccessDecisionManager" />
<beans:property name="securityMetadataSource" ref="mySecurityMetadataSource" />
</beans:bean>
這段代碼,註釋寫的比較好。配置啥的 等理解後在進一步看。