2

I'm just wondering if we have a page level permission settings in Shiro? For example I have a jsf page that I only want to show in user with role staff and permission delete.

In JBoss we have something like:

<page xmlns="http://jboss.com/products/seam/pages"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd">
    <restrict>#{persistentPermissionResolver.hasPermission('staff','delete')}</restrict>
</page>

Is this functionality also available in JavaEE6 + Shiro + JSF? It seems the JSP and JSF plugin only supports enabling a certain portion of a webpage being accessible to a certain role with a certain permission.

Thanks,
czetsuya

4

2 に答える 2

1

Shiro アノテーションが JavaEE6 プロジェクトで機能しないで回答されているように、Shiro アノテーションを使用するようにプロジェクトを構成する場合、リクエスト スコープのマネージド Bean のクラス レベルで目的の Shiro アノテーションを配置するだけで、ページ レベルの制限を設定できるはずです。

@Named
@RequestScoped
@ShiroSecured
@RequiresPermissions("staff:delete")
public class SomeBean {
    // ...
}
于 2013-01-23T12:05:00.597 に答える
0

しばらくいじった後、Seam と同じ機能を持つことは不可能であるという結論に達しましたが、Apache Shiro はパーミッションを通じて同様のきめ細かい制御を提供します。誰が何にアクセスするかを制御できます。Apache Shiro を JavaEE6 と統合する方法については、次のようにしました: http://czetsuya-tech.blogspot.com/2012/10/how-to-integrate-apache-shiro-with.html

于 2012-10-11T06:39:31.590 に答える