我刚刚开始使用Grails和Shiro,并且正在考虑将Shiro添加到现有项目中。
我想知道Shiro标签isLoggedIn
和authenticated
的意思是否相同(即始终产生相同的结果)吗?
Grails Shiro Plugin page似乎表明:
The tags
<shiro:isLoggedIn>
and<shiro:authenticated>
check for an authenticated user, the tag<shiro:user>
checks for a known user (authenticated or remembered) and the tag<shiro:remembered>
checks only for a remembered user.
但这几乎不是深入的描述,也没有解释为什么如果它们相同则两者都存在。
最佳答案
是的,它们是完全一样的。 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
关于grails - Shiro标签 'isLoggedIn'和 'authenticated'表示同一意思吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7315759/