1. 程式人生 > >shiro 登入不執行授權回撥方法doGetAuthorizationInfo

shiro 登入不執行授權回撥方法doGetAuthorizationInfo

轉載自:http://blog.csdn.net/qq_31759675/article/details/72268141

登入頁面跳轉業務處理


SpringMVC控制器


Shiro配置檔案

  1. <beansxmlns="http://www.springframework.org/schema/beans"
  2.     xmlns:context="http://www.springframework.org/schema/context"xmlns:p="http://www.springframework.org/schema/p"
  3.     xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"
  4.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5.     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd  
  6.     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd  
  7.     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd  
  8.     http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">
  9.     <!-- 1. 配置 SecurityManager! -->
  10.     <beanid="securityManager"class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
  11.         <propertyname="cacheManager"ref="cacheManager"/>
  12.         <propertyname="authenticator"ref="authenticator"/>
  13.         <propertyname="realms">
  14.             <list>
  15.                 <refbean="jdbcRealm"/>
  16.                 <!-- <ref bean="shiroRealm"/> -->
  17.             </list>
  18.         </property>
  19.         <!-- 設定登入時長 半天12個小時、-->
  20.         <propertyname="rememberMeManager.cookie.maxAge"value="43200"></property>
  21.     </bean>
  22.     <!-- 2. 配置 CacheManager. -->
  23.     <beanid="cacheManager"class="org.apache.shiro.cache.ehcache.EhCacheManager">
  24.         <propertyname="cacheManagerConfigFile"value="classpath:shiro/ehcache.xml"/>
  25.     </bean>
  26.     <beanid="authenticator"class="org.apache.shiro.authc.pam.ModularRealmAuthenticator">
  27.         <propertyname="authenticationStrategy">
  28.             <beanclass="org.apache.shiro.authc.pam.AtLeastOneSuccessfulStrategy"></bean>
  29.         </property>
  30.     </bean>
  31.     <!-- 3. 配置 多Realm驗證:MD5 SHA1... 3.1 直接配置實現了 org.apache.shiro.realm.Realm 介面的 bean -->
  32.     <beanid="jdbcRealm"class="com.vnasi.realms.ShiroRealm">
  33.         <propertyname="credentialsMatcher">
  34.             <beanclass="org.apache.shiro.authc.credential.HashedCredentialsMatcher">
  35.                 <propertyname="hashAlgorithmName"value="MD5"/>
  36.                 <propertyname="hashIterations"value="1024"/>
  37.             </bean>
  38.         </property>
  39.     </bean>
  40.     <!-- 暫時沒用上 -->
  41.     <!-- <beanid="shiroRealm"class="com.vnasi.realms.SecondRealm">
  42.         <propertyname="credentialsMatcher">
  43.             <beanclass="org.apache.shiro.authc.credential.HashedCredentialsMatcher">
  44.                 <propertyname="hashAlgorithmName"value="SHA1"/>
  45.                 <propertyname="hashIterations"value="1024"/>
  46.             </bean>
  47.         </property>
  48.     </bean> -->
  49.     <!-- 4. 配置 LifecycleBeanPostProcessor. 可以自定的來呼叫配置在 Spring IOC 容器中 shiro bean 的生命週期方法. -->
  50.     <beanid="lifecycleBeanPostProcessor"class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
  51.     <!-- 5. 啟用 IOC 容器中使用 shiro 的註解. 但必須在配置了 LifecycleBeanPostProcessor 之後才可以使用. -->
  52.     <beanclass="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"depends-on="lifecycleBeanPostProcessor"/>
  53.     <beanclass="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
  54.         <propertyname="securityManager"ref="securityManager"/>
  55.     </bean>
  56.     <!-- 6. 配置 ShiroFilter. -->
  57.      <beanid="shiroFilter"class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
  58.         <propertyname

    相關推薦

    shiro 登入執行授權方法doGetAuthorizationInfo

    轉載自:http://blog.csdn.net/qq_31759675/article/details/72268141 這 是 什 麼 鬼 ! 登入頁面跳轉業務處理 SpringMVC控制

    jquery通過ajax方法獲取本地json檔案執行success

    //a.json { list:{ createtime:"2018/11/05 16:45:22", status: 0, name: "aa", price: "188.00", num: "2", img: "1.jpg" } }

    java多執行方法

    所謂回撥,就是客戶程式C呼叫服務程式S中的某個方法A,然後S又在某個時候反過來呼叫C中的某個方法B,對於C來說,這個B便叫做回撥方法。 下面看一個實際例子來理解: 本示例設定一個提問者,一個回答者,而回答者需要回答提問者一個很深奧的問題時,這時需要很多時間去查詢,提問者又

    ajax執行success而是執行error

           除錯程式碼遇到一個問題,就是前臺執行刪除操作後,controller返回資料,但前臺接收時,ajax不執行success回撥,總是彈出失敗的對話方塊.接收資料型別是json. 先看看

    微信登登入授權呆起授權頁面之後點選授權出現授權失敗,code為-2 message為使用者取消,能正確

    按照官方文件的整合步驟,我們在Android平臺離線打包授權登陸外掛配置的時候,又一步是要求加入一個WXEntryActivity.java檔案,這一步的使用者包名一定要注意: a,微信支付依賴 【包名】.wxapi.WXPayEntryActivity 如:io.dcloud.HBuilder

    shiro和Spring整合使用註解時沒有執行realm的doGetAuthorizationInfo方法的解決

    在使用Shiro框架進行專案整合時,使用註解在使用Shiro框架進行專案整合時,使用註解在使用Shiro框架進行專案整合時,使用註解@RequiresPermissions為方法提供是需要的許可權,但是根本沒有進行驗證,後面發現在自己的Realm中只執行了doGetAuth

    winform-彈窗介面使用DIALOGRESULT判斷結果並返回內容,而使用方法,解決主窗體獲取到焦點問題

    確認後,不使用回撥返回內容,因為這樣的話,對話會影響很多功能問題,比如,獲取焦點等,在窗體還沒有釋放之前,這些方式都無效  private void ConfirmSelectCell(Object item)         {  

    【問題解決】Auth 2.0 登入成功方法

    絮絮叨 第三方的登入的解決方案通常有兩種方式,一是開啟一個新的標籤頁,然後登入回調回來; 二是通過父視窗開啟一個子窗體去第三方登入,登陸成功時關掉子窗體回到父視窗。 問題來了 我的父窗體怎麼樣才知道子窗體被關閉了呢? 查了下 w3c 裡面的文件,

    RxJava請求資料的方法在主執行緒處理

    RxJava的Observer的介面回撥方法如下:Subscriber<String> subsciber = new Subscriber<String>() { @Override public void onCompleted()

    iOS開發之swift與OC混編出現的坑,oc中能對swift的代理進行呼叫,能訪問swift中的代理,swift中的方法

    1. swift與oc混編譯具體怎麼實現,這兒我就不重複講出了,網上有大把的人講解。 2. 在swift與OC混編的編譯環境下, oc類不能訪問swift建立類中的代理? 解決方法如下: 在代理的頭部加上 @objc(代理名字),這樣就在外部就可以訪問了,如下圖。 然

    Andorid 混淆後JS的方法起作用了

    今天有一個bug,就是webview跟js互動的方法怎麼也調不起來,debug包問題,release包就出錯,想想是打包時混淆的問題,打了一個不混淆的包,果不其然,就是混淆的問題。 然後就找解決方案,在proguard-project檔案中有這麼一句 ? 1 2 3

    locationManager 方法呼叫問題?

    當locationManager都設定好了後開始定位服務後回撥方法didUpdateToLocation不呼叫 [_locationManagersetDelegate:self];  [_locationManagerstartUpdatingLocation]; 結

    Jni 多執行緒程式設計,子執行java方法

    由於c++層接收到服務端主動推送tcp資料,所以存在將c++層接收到的socket資料通過層層回撥至java的需求。 以下為c++程式碼段: 1:在c++標頭檔案中定義申明相應回撥函式指標 typedef void (*SwitchStateC

    支付寶 應用閘道器和授權地址怎麼配置?

    說明   我們在建立應用以後在應用的概覽中看到應用閘道器和授權回撥地址不知道該怎麼使用(如下圖)   名詞解釋   應用閘道器:用於接收由支付寶伺服器通知。使用介面:生活號介面和口碑門店被動通知   注意:如果您現

    關於startActivityForResult()方法,如果是A跳轉B,B的launchMode屬性為singleInstance,A的onActivityResult()方法會在什麼時候呼叫呢

    如題: 關於startActivityForResult()方法,如果是A跳轉B,B的launchMode屬性為singleInstance,A的onActivityResult()回撥方法會在什麼時候呼叫呢? A.B被啟動的時候即呼叫 B.B返回的時候呼叫 C.下一次A啟動的時候呼叫 D.不會

    關於ros多執行機制的一些內容

    Multithreading behaviour with ROS AsyncSpinner   I am trying to understand how the AsyncSpinner from ROS really works because I may have some

    kotlin安卓開發:fragment向activity傳遞資料通過handler,設定方法

    從activity向fragment傳遞就比較方便了,直接用: fg.arguments = arguments 現在看看怎麼從fragment向activity傳遞資料。 比如說,我們在一個ViewPage裡面設定了若干個fragment,fragment裡面有一個按鈕,提交相關

    button獲取使用者授權以及地理位置授權資訊

    1. 獲取使用者授權資訊 <button open-type='getUserInfo' bindgetuserinfo="getUserInfo">獲取使用者授權</button> 當前未授權的狀態下每次點選都會調起授權彈窗,getUserInfo函式為彈

    UGUI常見的方法

    //指令碼生命週期 //當指令碼例項被載入時被呼叫 private void Awake() { } //僅在update函式第一次被呼叫前呼叫 private void Start() { } //當指令碼處於可用被呼叫 private void O

    javscript setTimeout有參方法

    setTimeout傳遞的第一個引數為:  1.無參的方法:如function test(){},則可直接通過setTimeout(test,1000)呼叫,還可以setTimeout("test()",1000)呼叫。 2.如果方法接收引數:     (1) 如果