grails - Shiro标签 'isLoggedIn'和 'authenticated'表示同一意思吗?

标签 grails shiro

我刚刚开始使用Grails和Shiro,并且正在考虑将Shiro添加到现有项目中。

我想知道Shiro标签isLoggedInauthenticated的意思是否相同(即始终产生相同的结果)吗?

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/

相关文章:

grails - 代理 : install grails fails with 'curl received HTTP 403 from proxy after CONNECT' 后面的 sdkman

grails - 将图像与Grails Assets 管道捆绑在一起是否有意义?

java - Autowiring 在 Apache Shiro 自定义 Realm 类中不起作用

grails - 在grails中删除使用shiro安全插件注册的用户

security - Shiro 注释不适用于 JavaEE6 项目

google-app-engine - 使用Grails/GORM在Appengine上建立一对多关系

mongodb - 使用Mongodb的持久JSON响应

grails - 如何实现Grails域类的投票?

java - Spring MongoDB 和 Apache Shiro

Apache shiro 属性 'sessionManager.globalSessionTimeout' 不存在