当前位置: 首页 > news >正文

免费网站的app网站响应式技术

免费网站的app,网站响应式技术,多语言网站开发,开发板停止维护后如何处理J2EE/EJB 论坛 / XForum 里用 Filter 编程实现安全访问控制cinc 2003.03.11#xff0c; 15个回复#xff0c; 1745次浏览在 J2ee 里#xff0c;实现安全有两种#xff1a; 用声明实现安全#xff0c;就是在 web.xml 里实现安全限制。 用编程实现安全#xff0c;自己写代码…J2EE/EJB 论坛 / XForum 里用 Filter 编程实现安全访问控制cinc 2003.03.11 15个回复 1745次浏览在 J2ee 里实现安全有两种 用声明实现安全就是在 web.xml 里实现安全限制。 用编程实现安全自己写代码 在 XForum 里我们没有让 container 来管理安全检查我们使用的是自己编程实现的 用户登陆后把用户的信息存放在 session 里通过检查 session 中的用户信息就可以 知道用户是否登陆成功了。 XForum 以前的版本里这个检查过程是在分散在每个被保护的页面里做的比如 在 ViewMyThreadAction 里         final HttpSession session  request.getSession();         // If the user is null which means the user has not loged in,         // forward it to logon screen         if( userId  null || userId.length()  0 ){              final String url  /viewMyThreads.go;              request.setAttribute( ForumConstants.DEST_URL, url );              return (mapping.findForward(logon));              // Else display the users threads         }else{         。。。 如果用户没有登陆把当前页面存放在 session 中转到 logon 页面让用户登陆。 在 XForum 新版本里我们用了 Filter 技术做集中的 acl 控制 AclFilter 首先把需要包含的页面存放在一个 acl-config.xml 里 protected-resource uripost.go/uri descPost Thread Form/desc /protected-resource protected-resource uriviewMyThreads.go/uri descView My Thread/desc /protected-resource /acl-config 在 web.xml 对每个 web resource 都应用 这个 Filter filter filter-nameAclFilter/filter-name filter-classorg.redsoft.forum.filters.AclFilter/filter-class /filter filter-mapping filter-nameAclFilter/filter-name url-pattern/*/url-pattern /filter-mapping 在 AclFilter 的 doFilter 方法里检查如果请求的 uri 是 protected resource而且 session 中没有用户信息就转向到 logon 页面 这样如果以后要添加保护页面只需要在 acl-config.xml 里加上一个 protected-resource 就可以了而且也可以保护静态页面.html 的页面动态页面里的代码由于少了检查用户登陆的代码也清晰了很多。 :) 目前还实现不了现在只有两个角色   guest 用户不能访问 protected resource   登陆  用户可以访问所有的资源 不过在现有的 acl-config.xml 的基础上加以修改应该可以实现可以定义几个 role 比如 guest, user, manager然后修改 acl-config.xml 如下     protected-resource         uripost.go/uri         descPost Thread Form/desc         rolemanager,user/role     /protected-resource 实现复杂的 acl 控制使用filter是个好办法tomcat曾经使用安全拦截部件Security Interuptor (org.apache.tomcat.request.SecurityCheck)来实现web.xml中申明的资源授权。 我们完全可以参考这个类来实现自己的安全过滤器(使用JNDI或JDBC资源)。 而读取的是web.xml中的资源配置信息。这样就非常灵活了。 web.xml的配置并不需要在java中写上角色名的问题改动角色名不需要修改代码。这 是servlet规范中的一段原文SRV12.3 For example, to map the security role reference FOO to the security role with role-name manager the syntax would be:  security-role-ref    role-nameFOO/role-name    role-linkmanager/manager  /security-role-ref In this case if the servlet called by a user belonging to the manager securiyt role made the API call isUserInRole(FOO) would be true. 那么在程序中只要写明FOO使用role-link可以将其他角色也视为同义词。用 application 还是 container 管理安全确实是 J2EE 程序设计时需要好好考虑的问题 XForum 的 Filter 其实是参照 Sun Pet Store 的 SignonFilter 简化改写的 在 Pet Store 的文档里有很大一段篇幅是来讲 SignonFilter 的有兴趣的可以看看 All users in the pet store are logged in as the same system user, so they all have the same system permissions, such as whether or not they can execute a certain method. Application permissions, such as who can create an order  (registered users only), are modelled and controlled at the application level. Casual users such as the shoppers in the pet store do not have to authenticate their real-life identity in any way. In such cases, its usually preferable  to manage users in the application layer instead of at the system layer. Users with special permissions, such as system or application administrators, are  usually best represented by system users, using the J2EE login mechanisms  mentioned above. ftp://210.52.88.133/pub/doc/java/j2ee/petstore/sample-app1.3.1.pdf 回应这个帖子
http://wiki.neutronadmin.com/news/328300/

相关文章:

  • 物业建设网站客户关系管理理论
  • 网站建设实训心得及收获wordpress 登陆后返回
  • 全球建筑设计网站网站建设宣传图ps
  • 三明北京网站建设北京价格网站建设
  • 电商网站开发的目的和意义百度网站建设中的自由容器
  • 手机 网站 模板医院内外网站建设
  • 临沂网站设计哪家好php网站开发技术 pdf
  • 网站推广方法有几种下载百度语音导航地图安装
  • 网站建设需要啥深圳优化公司公认安高粱seo
  • 太原搭建网站的公司哪家好wap网站生成小程序
  • 二手交易网站建设高校门户网站系统
  • 网站开发建设合同给网站做图
  • wordpress百度推送工具青岛网站seo价格
  • 织梦大气婚纱影楼网站源码saas电商建站系统
  • 在合肥做网站前端月薪大概多少钱网站设计 中国风
  • 可以做思维导图的网站苗木门户网站模板
  • wordpress文章什么时候收录百家港 seo服务
  • 嘉兴有能做网站优化杭州微网站建设公司
  • 网站开发设计知乎网络哪个公司好
  • 重庆哪里有做淘宝网站推广的wordpress 主题安装目录
  • 衡水做网站哪儿好找客户的十大方法
  • 酷黑网站微信建立免费网站
  • 南通网站制作公司哪家好江苏最新消息今天
  • 网站建设 微信小程序虫虫wap建站源码
  • 本溪网站建设兼职网页浏览器的缩写
  • 北京做网站比较好的mega Wordpress
  • 汽车网站网页设计import wordpress
  • 做百度网站每年的费用多少钱南昌网站建设模板合作
  • 一般vs做的网站的总体框架英文营销网站建设
  • 镇江网站制作价格电脑网站建设