0

私は Grails と Shiro の両方を使い始めたばかりで、既存のプロジェクトに Shiro を追加することを検討しています。

isLoggedInShiro のタグとタグが同じことを意味するかどうか疑問に思っていますauthenticated(つまり、常に同じ結果が生成されます)。

Grails Shiro Plugin ページでは、次のように提案されているようです。

タグ<shiro:isLoggedIn><shiro:authenticated>認証済みユーザーの<shiro:user>チェック、タグは既知のユーザー (認証済みまたは記憶済み) をチェックし、タグ<shiro:remembered>は記憶済みユーザーのみをチェックします。

しかし、それはほとんど詳細な説明ではなく、それらが同じである場合になぜ両方が存在するのかを説明していません.

4

1 に答える 1

1

はい、まったく同じです。 ソースコードは次のとおりです。

/**
 * 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
于 2011-09-06T12:35:35.507 に答える