2011-09-06 46 views
0

我剛剛開始使用Grails和Shiro,我正在考慮將Shiro添加到現有項目中。Shiro標籤'isLoggedIn'和'認證'是否意味着同樣的事情?

我想知道Shiro標籤isLoggedInauthenticated是否意味着相同的東西(即總是產生相同的結果)?

Grails Shiro Plugin page似乎在暗示這樣:

只爲記住的標籤<shiro:isLoggedIn><shiro:authenticated>檢查認證用戶,標籤<shiro:user>檢查已知用戶(認證或記憶)和標籤<shiro:remembered>檢查用戶。

但它不是一個深入的描述,它不能解釋爲什麼他們都存在,如果他們是相同的。

回答

1

是的,它們完全一樣。 Here is the source code

/** 
* This tag only writes its body to the output if the current user 
* is logged in. 
*/ 
def isLoggedIn = { attrs, body -> 
    if (checkAuthenticated()) { 
     out << body() 
    } 
} 

/** 
* A synonym for 'isLoggedIn'. This is the same name as used by 
* the standard Shiro tag library. 
*/ 
def authenticated = isLoggedIn 
+0

鏈接到源代碼是一個很好的參考。謝謝 – David

相關問題