Question

I'd like to read a properties file in my applications WEB-INF folder or my tomcat/apache server from a JAAS loginModule. But I'm not understanding how to properly refer to the location from the LoginModule, in a host name independent manner.

Was it helpful?

Solution

You could use the catalina.base system property:

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();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top