【问题标题】:How to give JSP permissions with SecurityManager policy file in Resin?如何使用 Resin 中的 SecurityManager 策略文件授予 JSP 权限?
【发布时间】:2009-08-25 08:18:25
【问题描述】:

我们正在尝试将 SecurityManager 与 Resin 3.1.9 一起使用并遇到以下问题:CodeSource.getLocation() 为已编译的 JSP 返回 null。

这意味着我们不能在我们的策略文件的授权子句中使用特定的代码库,例如:

grant codeBase "file:/path_to_resin/runtime/work/-" {
OR grant codeBase "file:/path_to_resin/webapp/JSP-source/-" {
  //...some jsp-specific permissions
};

相反,我们必须使用通用授权子句:

grant  {
  //..some jsp-specific permissions. Unfortunately, these will be applied
  //to all code!!!
};

有没有办法让 JSP 有合适的 CodeSource?我们想限制第三方库的权限,但给我们自己的 JSP 权限。如果我们无法在策略文件中指定 JSP,我们可能无法做到这一点,或者您怎么看?

编辑:我们按原样部署 JSP,所以不要重新编译它们。这可能与问题有关。

【问题讨论】:

    标签: java jsp resin securitymanager


    【解决方案1】:

    我通过 Resin 邮件列表得到了答复,并认为我也将其发布在这里:

    Resin 3 似乎有这个问题,现在有an issue for it。基本上我们尝试的方式应该可以工作,或者至少可以在 Resin 2 上工作。所以,这应该可以工作:

    grant codeBase "file:/path_to_resin/runtime/work/-" {
      //...some jsp-specific permissions
    };
    

    Resin 的开发负责人这样说:“嗯,安全管理器会扼杀性能,所以我们通常不鼓励这样做。”我们可能不得不重新考虑使用 SecurityManager 是否合理。有关该主题的更多讨论,请参阅我的另一个问题 Should I use Security Manager in Java web applications?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-08
      • 2023-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多