首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Tomcat中的ESAPI属性文件

Tomcat中的ESAPI属性文件
EN

Stack Overflow用户
提问于 2013-01-31 00:17:38
回答 1查看 4.8K关注 0票数 0

我在Tomcat war应用程序中使用了ESAPI加密。我希望从war外部的目录加载ESAPI.properties文件,以便为每个环境提供不同的密钥和salt。我还希望每个war都有一个不同的ESAPI.properties文件,这样每个应用程序都可以进行个性化配置。根据org.owasp.esapi.reference.DefaultSecurityConfiguration的文档,有几种方法可以实现这一点。

1) SecurityConfiguration.setResourceDirectory( "C:\temp\resources“)。

2) System.getProperty( "org.owasp.esapi.resources“)

3)在System.getProperty( "user.home“)+ "/.esapi”目录中

4)类路径上的第一个".esapi“或"esapi”目录。

前3个选项将对每个tomcat强制执行一个配置。这意味着属性文件位置在所有已部署的wars上都是强制的。(第一个选项使用ClassLoader.getSystemResource -requires该路径作为类路径的一部分)

有没有办法使用Tomcat配置来完成这个任务?

我还找到了一种覆盖ESAPI默认安全配置的方法,我可以扩展DefaultSecurityConfiguration并覆盖getResourceFile,但是ESAPI javadoc说“永远”不应该使用这个方法--我不确定原因是什么。

代码语言:javascript
复制
 package org.owasp.esapi;
 public final class ESAPI{   
 /**
 * Overrides the current security configuration with a new implementation. This is meant
 * to be used as a temporary means to alter the behavior of the ESAPI and should *NEVER*
 * be used in a production environment as it will affect the behavior and configuration of
 * the ESAPI *GLOBALLY*.
 *
 * To clear an overridden Configuration, simple call this method with null for the config
 * parameter.
 *
 * @param config
 * @return
 */
public static void override( SecurityConfiguration config ) {
    overrideConfig = config;
}

有什么建议吗?

EN

回答 1

Stack Overflow用户

发布于 2014-05-01 03:33:26

如果您想要为特定实例配置tomcat,首先想到的就是使用tomcat的setenv.sh脚本进行设置。就像这样

代码语言:javascript
复制
export JAVA_OPTS='$JAVA_OPTS -Dorg.owasp.esapi.resources="/path/resources"'
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14608638

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档