zoukankan      html  css  js  c++  java
  • Apache Shiro内置过滤器

    shiro内置过滤器研究  

    anon org.apache.shiro.web.filter.authc.AnonymousFilter
    authc org.apache.shiro.web.filter.authc.FormAuthenticationFilter
    authcBasic
    org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter
    perms
    org.apache.shiro.web.filter.authz.PermissionsAuthorizationFilter
    port
    org.apache.shiro.web.filter.authz.PortFilter
    rest
    org.apache.shiro.web.filter.authz.HttpMethodPermissionFilter
    roles
    org.apache.shiro.web.filter.authz.RolesAuthorizationFilter
    ssl org.apache.shiro.web.filter.authz.SslFilter
    user org.apache.shiro.web.filter.authc.UserFilter

     

    rest:例子/admins/user/**=rest[user],根据请求的方法,相当于/admins/user/**=perms[user:method] ,其中method为post,get,delete等。
    port:例子/admins/user/**=port[8081],当请求的url的端口不是8081是跳转到schemal://serverName:8081?queryString,其中schmal是协议http或https等,serverName是你访问的host,8081是url配置里port的端口,queryString是你访问的url里的?后面的参数。
    perms:例子/admins/user/**=perms[user:add:*],perms参数可以写多个,多个时必须加上引号,并且参数之间用逗号分割,例如/admins/user/**=perms["user:add:*,user:modify:*"],当有多个参数时必须每个参数都通过才通过,想当于isPermitedAll()方法。
    roles:例子/admins/user/**=roles[admin],参数可以写多个,多个时必须加上引号,并且参数之间用逗号分割,当有多个参数时,例如/admins/user/**=roles["admin,guest"],每个参数通过才算通过,相当于hasAllRoles()方法。
    anon:例子/admins/**=anon 没有参数,表示可以匿名使用。
    authc:例如/admins/user/**=authc表示需要认证才能使用,没有参数
    authcBasic:例如/admins/user/**=authcBasic没有参数表示httpBasic认证
    ssl:例子/admins/user/**=ssl没有参数,表示安全的url请求,协议为https
    user:例如/admins/user/**=user没有参数表示必须存在用户,当登入操作时不做检查
     
    这些过滤器分为两组,一组是认证过滤器,一组是授权过滤器。

    其中anon,authcBasic,auchc,user是第一组,

    perms,roles,ssl,rest,port是第二组
  • 相关阅读:
    win10下jdk8和jdk11切换的批处理脚本
    Deeping中使用python连接Oralce报错:Cannot locate a 64-bit Oracle Client library: "./instantclient_21_1/libclntsh.so: file too short"
    Redis作者“不懂”分布式锁【转载】
    搭建nacos高可用集群
    使用spring.config.location与本地配置文件属性不能互补
    protocol buffer应用场景方案想法
    protocol buffer 入门和基本知识
    IDEA快捷键
    软考问题总结
    pandas 使用问题记录
  • 原文地址:https://www.cnblogs.com/2018/p/2777790.html
Copyright © 2011-2022 走看看