• <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 - 我并不覺的自豪,我所嘗試的事情都失敗了······習慣原本生活的人不容易改變,就算現狀很糟,他們也很難改變,在過程中,他們還是放棄了······他們一放棄,大家就都是輸家······讓愛傳出去,很困難,也無法預料,人們需要更細心的觀察別人,要隨時注意才能保護別人,因為他們未必知道自己要什么·····

            /**

            * Shiro-1.2.2內置的FilterChain

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

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

            * @see   故filterChainDefinitions的配置順序為自上而下,以最上面的為準

            * @see 2)當運行一個Web應用程序時,Shiro將會創建一些有用的默認Filter實例,并自動地在[main]項中將它們置為可用

            * @see   自動地可用的默認的Filter實例是被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是第一組認證過濾器

            * @see   perms,port,rest,roles,ssl是第二組授權過濾器

            * @see   注意user和authc不同:當應用開啟了rememberMe時,用戶下次訪問時可以是一個user,但絕不會是authc,因為authc是需要重新認證的

            * @see                      user表示用戶不一定已通過認證,只要曾被Shiro記住過登錄狀態的用戶就可以正常發起請求,比如rememberMe

            * @see                      說白了,以前的一個用戶登錄時開啟了rememberMe,然后他關閉瀏覽器,下次再訪問時他就是一個user,而不會authc

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

            * @see 4)舉幾個例子

            * @see   /admin=authc,roles[admin]      表示用戶必需已通過認證,并擁有admin角色才可以正常發起'/admin'請求

            * @see   /edit=authc,perms[admin:edit]  表示用戶必需已通過認證,并擁有admin:edit權限才可以正常發起'/edit'請求

            * @see   /home=user                     表示用戶不一定需要已經通過認證,只需要曾經被Shiro記住過登錄狀態就可以正常發起'/home'請求

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

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

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

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

            * @see   /admins/user/**=authcBasic  無參,表示httpBasic認證

            * @see   /admins/user/**=user        無參,表示必須存在用戶,當登入操作時不做檢查

            * @see   /admins/user/**=ssl         無參,表示安全的URL請求,協議為https

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

            * @see       參數可寫多個,多參時必須加上引號,且參數之間用逗號分割,如/admins/user/**=perms["user:add:*,user:modify:*"]

            * @see       當有多個參數時必須每個參數都通過才算通過,相當于isPermitedAll()方法

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

            * @see       當請求的URL端口不是8081時,跳轉到schemal://serverName:8081?queryString

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

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

            * @see       根據請求的方法,相當于/admins/user/**=perms[user:method],其中method為post,get,delete等

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

            * @see       參數可寫多個,多個時必須加上引號,且參數之間用逗號分割,如/admins/user/**=roles["admin,guest"]

            * @see       當有多個參數時必須每個參數都通過才算通過,相當于hasAllRoles()方法

            * @see

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

            spring中 shiro logout 配置方式
            有兩種方式實現logout
            1. 普通的action中 實現自己的logout方法,取到Subject,然后logout
            這種需要在ShiroFilterFactoryBean 中配置 filterChainDefinitions
            對應的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
            需要定義 相應的bean
            <bean id="logout" class="org.apache.shiro.web.filter.authc.LogoutFilter">
                    <property name="redirectUrl" value="/loginform" />
                </bean>

            然后將相應的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 小果子 閱讀(72184) 評論(4)  編輯 收藏 引用 所屬分類: 框架

            FeedBack:
            # re: shrio 權限管理filterChainDefinitions過濾器配置
            2015-05-04 14:56 | 得到
            得到  回復  更多評論
              
            # re: shrio 權限管理filterChainDefinitions過濾器配置
            2015-06-29 17:34 | 嘍啰
            謝謝  回復  更多評論
              
            # re: shrio 權限管理filterChainDefinitions過濾器配置
            2015-10-28 10:11 | gyh112358
            看博客上的背景圖片,簡直血虐單身狗啊  回復  更多評論
              
            # re: shrio 權限管理filterChainDefinitions過濾器配置
            2016-02-08 04:46 | 麥海堂
            shrio 權限管理filterChainDefinitions過濾器配置   回復  更多評論
              
            久久国产成人精品麻豆| 99久久国产宗和精品1上映 | 久久综合欧美成人| 久久国产香蕉视频| 久久久久亚洲AV无码专区桃色| 伊人久久大香线蕉综合热线| 亚洲精品无码久久久| 精品伊人久久大线蕉色首页| 99久久综合国产精品二区| 婷婷国产天堂久久综合五月| 亚洲va中文字幕无码久久 | 久久综合亚洲欧美成人| 精品久久久久久国产91| 欧美伊人久久大香线蕉综合69 | 无码精品久久久天天影视| 国内精品久久久久久野外| 久久99精品久久久久久不卡| 久久精品中文闷骚内射| 久久久国产视频| 91精品久久久久久无码| 精品一区二区久久久久久久网站| 精品久久久久久无码人妻热| 久久久亚洲欧洲日产国码aⅴ | 91久久精品电影| 亚洲国产精品无码久久一线| 最新久久免费视频| 国产成人综合久久久久久| 亚洲AV无码久久精品成人| 人妻系列无码专区久久五月天| 国内精品久久国产大陆| www.久久热| 国内精品久久久久久久久电影网 | 久久九九兔免费精品6| 久久久久九国产精品| 91精品观看91久久久久久| 青青热久久综合网伊人| 久久香蕉综合色一综合色88| 久久人人爽爽爽人久久久| 午夜精品久久久久久毛片| 伊人久久大香线蕉av不变影院| 久久精品国产男包|