shiro access control configuration

shiro configuration process

  1. a filter disposed in web.xml shiro
  2. spring configured shiro filter factory, specify a different address access control
    , incoming security manager
  3. Configuring security manager, incoming realm, realm defined specific authorization and authentication process
  4. Configure a custom certificate matcher, and the specified token info matched.

Access to configuration

  1. String define all rights collection
    in the collection of custom realm String override doGetAuthoriaztionInfo (), create all permissions,
    create SimpleAuthorizationInfo the object, call addStringPermission, add a set of permissions, return the object

  2. Permissions control access to specified resources needed

    a. with parity codes.
    // get the current Subject
    Subject Subject = SecurityUtils.getSubject ();
    // check whether the specified permissions
    subject.checkPermission ( "sector management");

    b. Configure knockdown address filter plant
    /system/user/list.do = perms [ "Management sector"]
    /system/user/list.do = authc, Roles [User Management]

    c. Notes to realize
    @RequiresPermissions ( "User Management")

  3. Shiro use tags view rendering control
    <shiro:hasPermission name="用户管理">
        用户管理数据
    </shiro:hasPermission>

Guess you like

Origin www.cnblogs.com/tianzhen45/p/11407182.html