• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            xiaoguozi's Blog
            Pay it forword - 我并不覺的自豪,我所嘗試的事情都失敗了······習(xí)慣原本生活的人不容易改變,就算現(xiàn)狀很糟,他們也很難改變,在過程中,他們還是放棄了······他們一放棄,大家就都是輸家······讓愛傳出去,很困難,也無法預(yù)料,人們需要更細(xì)心的觀察別人,要隨時(shí)注意才能保護(hù)別人,因?yàn)樗麄兾幢刂雷约阂裁础ぁぁぁぁ?/span>

            /**

            * Shiro-1.2.2內(nèi)置的FilterChain

            * @see =============================================================================================================================

            * @see 1)Shiro驗(yàn)證URL時(shí),URL匹配成功便不再繼續(xù)匹配查找(所以要注意配置文件中的URL順序,尤其在使用通配符時(shí))

            * @see   故filterChainDefinitions的配置順序?yàn)樽陨隙?以最上面的為準(zhǔn)

            * @see 2)當(dāng)運(yùn)行一個(gè)Web應(yīng)用程序時(shí),Shiro將會(huì)創(chuàng)建一些有用的默認(rèn)Filter實(shí)例,并自動(dòng)地在[main]項(xiàng)中將它們置為可用

            * @see   自動(dòng)地可用的默認(rèn)的Filter實(shí)例是被DefaultFilter枚舉類定義的,枚舉的名稱字段就是可供配置的名稱

            * @see   anon---------------org.apache.shiro.web.filter.authc.AnonymousFilter

            * @see   authc--------------org.apache.shiro.web.filter.authc.FormAuthenticationFilter

            * @see   authcBasic---------org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter

            * @see   logout-------------org.apache.shiro.web.filter.authc.LogoutFilter

            * @see   noSessionCreation--org.apache.shiro.web.filter.session.NoSessionCreationFilter

            * @see   perms--------------org.apache.shiro.web.filter.authz.PermissionAuthorizationFilter

            * @see   port---------------org.apache.shiro.web.filter.authz.PortFilter

            * @see   rest---------------org.apache.shiro.web.filter.authz.HttpMethodPermissionFilter

            * @see   roles--------------org.apache.shiro.web.filter.authz.RolesAuthorizationFilter

            * @see   ssl----------------org.apache.shiro.web.filter.authz.SslFilter

             *@see   user---------------org.apache.shiro.web.filter.authz.UserFilter

            * @see =============================================================================================================================

            * @see 3)通常可將這些過濾器分為兩組

            * @see   anon,authc,authcBasic,user是第一組認(rèn)證過濾器

            * @see   perms,port,rest,roles,ssl是第二組授權(quán)過濾器

            * @see   注意user和authc不同:當(dāng)應(yīng)用開啟了rememberMe時(shí),用戶下次訪問時(shí)可以是一個(gè)user,但絕不會(huì)是authc,因?yàn)閍uthc是需要重新認(rèn)證的

            * @see                      user表示用戶不一定已通過認(rèn)證,只要曾被Shiro記住過登錄狀態(tài)的用戶就可以正常發(fā)起請(qǐng)求,比如rememberMe

            * @see                      說白了,以前的一個(gè)用戶登錄時(shí)開啟了rememberMe,然后他關(guān)閉瀏覽器,下次再訪問時(shí)他就是一個(gè)user,而不會(huì)authc

            * @see =============================================================================================================================

            * @see 4)舉幾個(gè)例子

            * @see   /admin=authc,roles[admin]      表示用戶必需已通過認(rèn)證,并擁有admin角色才可以正常發(fā)起'/admin'請(qǐng)求

            * @see   /edit=authc,perms[admin:edit]  表示用戶必需已通過認(rèn)證,并擁有admin:edit權(quán)限才可以正常發(fā)起'/edit'請(qǐng)求

            * @see   /home=user                     表示用戶不一定需要已經(jīng)通過認(rèn)證,只需要曾經(jīng)被Shiro記住過登錄狀態(tài)就可以正常發(fā)起'/home'請(qǐng)求

            * @see =============================================================================================================================

            * @see 5)各默認(rèn)過濾器常用如下(注意URL Pattern里用到的是兩顆星,這樣才能實(shí)現(xiàn)任意層次的全匹配)

            * @see   /admins/**=anon             無參,表示可匿名使用,可以理解為匿名用戶或游客

            * @see   /admins/user/**=authc       無參,表示需認(rèn)證才能使用

            * @see   /admins/user/**=authcBasic  無參,表示httpBasic認(rèn)證

            * @see   /admins/user/**=user        無參,表示必須存在用戶,當(dāng)?shù)侨氩僮鲿r(shí)不做檢查

            * @see   /admins/user/**=ssl         無參,表示安全的URL請(qǐng)求,協(xié)議為https

            * @see   /admins/user/**=perms[user:add:*]

            * @see       參數(shù)可寫多個(gè),多參時(shí)必須加上引號(hào),且參數(shù)之間用逗號(hào)分割,如/admins/user/**=perms["user:add:*,user:modify:*"]

            * @see       當(dāng)有多個(gè)參數(shù)時(shí)必須每個(gè)參數(shù)都通過才算通過,相當(dāng)于isPermitedAll()方法

            * @see   /admins/user/**=port[8081]

            * @see       當(dāng)請(qǐng)求的URL端口不是8081時(shí),跳轉(zhuǎn)到schemal://serverName:8081?queryString

            * @see       其中schmal是協(xié)議http或https等,serverName是你訪問的Host,8081是Port端口,queryString是你訪問的URL里的?后面的參數(shù)

            * @see   /admins/user/**=rest[user]

            * @see       根據(jù)請(qǐng)求的方法,相當(dāng)于/admins/user/**=perms[user:method],其中method為post,get,delete等

            * @see   /admins/user/**=roles[admin]

            * @see       參數(shù)可寫多個(gè),多個(gè)時(shí)必須加上引號(hào),且參數(shù)之間用逗號(hào)分割,如/admins/user/**=roles["admin,guest"]

            * @see       當(dāng)有多個(gè)參數(shù)時(shí)必須每個(gè)參數(shù)都通過才算通過,相當(dāng)于hasAllRoles()方法

            * @see

            http://liureying.blog.163.com/blog/static/61513520136205574873/

            spring中 shiro logout 配置方式
            有兩種方式實(shí)現(xiàn)logout
            1. 普通的action中 實(shí)現(xiàn)自己的logout方法,取到Subject,然后logout
            這種需要在ShiroFilterFactoryBean 中配置 filterChainDefinitions
            對(duì)應(yīng)的action的url為anon
            <property name="filterChainDefinitions">
                        <value>
                            # some example chain definitions:
                            /index.htm = anon
                            /logout = anon
                            /unauthed = anon
                            /console/** = anon
                            /css/** = anon
                            /js/** = anon
                            /lib/** = anon
                            /admin/** = authc, roles[admin]
                            /docs/** = authc, perms[document:read]
                            /** = authc
                            # more URL-to-FilterChain definitions here
                        </value>

            2. 使用shiro提供的logout filter
            需要定義 相應(yīng)的bean
            <bean id="logout" class="org.apache.shiro.web.filter.authc.LogoutFilter">
                    <property name="redirectUrl" value="/loginform" />
                </bean>

            然后將相應(yīng)的url filter配置為logout如下
            <property name="filterChainDefinitions">
                        <value>
                            # some example chain definitions:
                            /index.htm = anon
                            /logout = logout
                            /unauthed = anon
                            /console/** = anon
                            /css/** = anon
                            /js/** = anon
                            /lib/** = anon
                            /admin/** = authc, roles[admin]
                            /docs/** = authc, perms[document:read]
                            /** = authc
                            # more URL-to-FilterChain definitions here
                        </value>

            http://kdboy.iteye.com/blog/1154652
            http://blog.csdn.net/peterwanghao/article/details/8084126
            http://www.oschina.net/question/593111_62454
            http://blog.csdn.net/shadowsick/article/details/17265625

            posted on 2014-05-14 11:57 小果子 閱讀(72204) 評(píng)論(4)  編輯 收藏 引用 所屬分類: 框架

            FeedBack:
            # re: shrio 權(quán)限管理filterChainDefinitions過濾器配置
            2015-05-04 14:56 | 得到
            # re: shrio 權(quán)限管理filterChainDefinitions過濾器配置
            2015-06-29 17:34 | 嘍啰
            # re: shrio 權(quán)限管理filterChainDefinitions過濾器配置
            2015-10-28 10:11 | gyh112358
            看博客上的背景圖片,簡直血虐單身狗啊  回復(fù)  更多評(píng)論
              
            # re: shrio 權(quán)限管理filterChainDefinitions過濾器配置
            2016-02-08 04:46 | 麥海堂
            shrio 權(quán)限管理filterChainDefinitions過濾器配置   回復(fù)  更多評(píng)論
              
            国产精品女同久久久久电影院| 青春久久| 人妻精品久久无码专区精东影业| 久久国产三级无码一区二区| 久久无码精品一区二区三区| 偷偷做久久久久网站| 性欧美丰满熟妇XXXX性久久久| 久久久免费精品re6| 国产ww久久久久久久久久| 伊人久久精品影院| 1000部精品久久久久久久久| 国产精品狼人久久久久影院| 久久亚洲精品无码VA大香大香| 国产一区二区精品久久| 少妇被又大又粗又爽毛片久久黑人 | 久久国产AVJUST麻豆| 久久精品人成免费| 亚洲国产成人久久综合区| 久久成人国产精品| 久久精品国产亚洲AV影院| 色综合久久精品中文字幕首页| 久久精品国产色蜜蜜麻豆| 99精品伊人久久久大香线蕉| 精产国品久久一二三产区区别| 久久精品国产亚洲一区二区| 久久精品国产色蜜蜜麻豆| 久久久久亚洲AV无码专区网站| 国产欧美久久一区二区| 香蕉久久夜色精品升级完成| 性做久久久久久免费观看| 国产巨作麻豆欧美亚洲综合久久| 久久精品中文无码资源站| 色播久久人人爽人人爽人人片AV| 久久久久99精品成人片牛牛影视 | 嫩草影院久久99| 久久99精品国产自在现线小黄鸭| 国产aⅴ激情无码久久| 久久亚洲欧洲国产综合| 久久久久婷婷| 亚洲欧美日韩精品久久亚洲区| 午夜精品久久久内射近拍高清|