mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-3244 - make checking of the file timestamps default for the jaas properties loging module
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1088955 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7fdd58e5b2
commit
a345cd3d56
|
@ -52,11 +52,13 @@ public class PropertiesLoginModule implements LoginModule {
|
|||
private CallbackHandler callbackHandler;
|
||||
|
||||
private boolean debug;
|
||||
private boolean reload = true;
|
||||
private boolean reload = false;
|
||||
private static String usersFile;
|
||||
private static String groupsFile;
|
||||
private static Properties users;
|
||||
private static Properties groups;
|
||||
private static long usersReloadTime = 0;
|
||||
private static long groupsReloadTime = 0;
|
||||
private String user;
|
||||
private Set<Principal> principals = new HashSet<Principal>();
|
||||
private File baseDir;
|
||||
|
@ -73,37 +75,39 @@ public class PropertiesLoginModule implements LoginModule {
|
|||
reload = "true".equalsIgnoreCase((String)options.get("reload"));
|
||||
}
|
||||
|
||||
if (reload || users == null) {
|
||||
setBaseDir();
|
||||
usersFile = (String)options.get(USER_FILE) + "";
|
||||
File uf = new File(baseDir, usersFile);
|
||||
setBaseDir();
|
||||
usersFile = (String) options.get(USER_FILE) + "";
|
||||
File uf = new File(baseDir, usersFile);
|
||||
if (reload || users == null || uf.lastModified() > usersReloadTime) {
|
||||
if (debug) {
|
||||
LOG.debug("Reloading users from " + usersFile);
|
||||
}
|
||||
try {
|
||||
users = new Properties();
|
||||
java.io.FileInputStream in = new java.io.FileInputStream(uf);
|
||||
users.load(in);
|
||||
in.close();
|
||||
usersReloadTime = System.currentTimeMillis();
|
||||
} catch (IOException ioe) {
|
||||
LOG.warn("Unable to load user properties file " + uf);
|
||||
}
|
||||
if (debug) {
|
||||
LOG.debug("Using usersFile=" + usersFile);
|
||||
}
|
||||
}
|
||||
if (reload || groups == null) {
|
||||
setBaseDir();
|
||||
groupsFile = (String)options.get(GROUP_FILE) + "";
|
||||
File gf = new File(baseDir, groupsFile);
|
||||
|
||||
groupsFile = (String) options.get(GROUP_FILE) + "";
|
||||
File gf = new File(baseDir, groupsFile);
|
||||
if (reload || groups == null || gf.lastModified() > groupsReloadTime) {
|
||||
if (debug) {
|
||||
LOG.debug("Reloading groups from " + groupsFile);
|
||||
}
|
||||
try {
|
||||
groups = new Properties();
|
||||
java.io.FileInputStream in = new java.io.FileInputStream(gf);
|
||||
groups.load(in);
|
||||
in.close();
|
||||
groupsReloadTime = System.currentTimeMillis();
|
||||
} catch (IOException ioe) {
|
||||
LOG.warn("Unable to load group properties file " + gf);
|
||||
}
|
||||
if (debug) {
|
||||
LOG.debug("Using groupsFile=" + groupsFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue