[英]How to read Java properties file from a JAAS LoginModule
I'd like to read a properties file in my applications WEB-INF folder or my tomcat/apache server from a JAAS loginModule. 我想从JAAS loginModule读取我的应用程序WEB-INF文件夹或tomcat / apache服务器中的属性文件。 But I'm not understanding how to properly refer to the location from the LoginModule, in a host name independent manner.
但是我不理解如何以独立于主机名的方式从LoginModule正确引用位置。
You could use the catalina.base system property: 您可以使用catalina.base系统属性:
File confDir = new File(System.getProperty("catalina.base"), "conf");
File confFile = new File(confDir, "myprops.properties");
InputStream in = new FileInputStream(confFile);
try {
props.load(in);
} finally {
in.close();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.