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.
From stackoverflow
-
Can't you put your properties in login.conf instead of in a properties file?
Martlark : I already have properties in the login.conf file but I wanted to use the same properties file as my spring application so as to reduce the amount of configuration proliferation i'm experiencing. -
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(); }
Martlark : Nice solution. Thanks for your help.
0 comments:
Post a Comment