git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@550451 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-06-25 10:57:57 +00:00
parent 5d41efce6a
commit b266786728
4 changed files with 20 additions and 12 deletions

View File

@ -119,8 +119,8 @@ public class LDAPLoginModule implements LoginModule {
userRoleName = (String) options.get(USER_ROLE_NAME);
userSearchMatchingFormat = new MessageFormat(userSearchMatching);
roleSearchMatchingFormat = new MessageFormat(roleSearchMatching);
userSearchSubtreeBool = new Boolean(userSearchSubtree).booleanValue();
roleSearchSubtreeBool = new Boolean(roleSearchSubtree).booleanValue();
userSearchSubtreeBool = Boolean.valueOf(userSearchSubtree).booleanValue();
roleSearchSubtreeBool = Boolean.valueOf(roleSearchSubtree).booleanValue();
}
public boolean login() throws LoginException {

View File

@ -44,8 +44,8 @@ import org.apache.commons.logging.LogFactory;
*/
public class PropertiesLoginModule implements LoginModule {
private final String USER_FILE = "org.apache.activemq.jaas.properties.user";
private final String GROUP_FILE = "org.apache.activemq.jaas.properties.group";
private static final String USER_FILE = "org.apache.activemq.jaas.properties.user";
private static final String GROUP_FILE = "org.apache.activemq.jaas.properties.group";
private static final Log log = LogFactory.getLog(PropertiesLoginModule.class);
@ -83,13 +83,17 @@ public class PropertiesLoginModule implements LoginModule {
public boolean login() throws LoginException {
File f = new File(baseDir,usersFile);
try {
users.load(new java.io.FileInputStream(f));
java.io.FileInputStream in = new java.io.FileInputStream(f);
users.load(in);
in.close();
} catch (IOException ioe) {
throw new LoginException("Unable to load user properties file " + f);
}
f = new File(baseDir, groupsFile);
try {
groups.load(new java.io.FileInputStream(f));
java.io.FileInputStream in = new java.io.FileInputStream(f);
groups.load(in);
in.close();
} catch (IOException ioe) {
throw new LoginException("Unable to load group properties file " + f);
}

View File

@ -47,8 +47,8 @@ import javax.security.auth.login.LoginException;
*/
public class TextFileCertificateLoginModule extends CertificateLoginModule {
private final String USER_FILE = "org.apache.activemq.jaas.textfiledn.user";
private final String GROUP_FILE = "org.apache.activemq.jaas.textfiledn.group";
private static final String USER_FILE = "org.apache.activemq.jaas.textfiledn.user";
private static final String GROUP_FILE = "org.apache.activemq.jaas.textfiledn.group";
private File baseDir;
private String usersFilePathname;
@ -88,7 +88,9 @@ public class TextFileCertificateLoginModule extends CertificateLoginModule {
Properties users = new Properties();
try {
users.load(new java.io.FileInputStream(usersFile));
java.io.FileInputStream in = new java.io.FileInputStream(usersFile);
users.load(in);
in.close();
} catch (IOException ioe) {
throw new LoginException("Unable to load user properties file " + usersFile);
}
@ -119,7 +121,9 @@ public class TextFileCertificateLoginModule extends CertificateLoginModule {
Properties groups = new Properties();
try {
groups.load(new java.io.FileInputStream(groupsFile));
java.io.FileInputStream in = new java.io.FileInputStream(groupsFile);
groups.load(in);
in.close();
} catch (IOException ioe) {
throw new LoginException("Unable to load group properties file " + groupsFile);
}

View File

@ -35,8 +35,8 @@ import javax.security.auth.Subject;
import javax.security.auth.login.LoginException;
public class CertificateLoginModuleTest extends TestCase {
private final String userName = "testUser";
private final List groupNames = new Vector();
private static final String userName = "testUser";
private static final List groupNames = new Vector();
private StubCertificateLoginModule loginModule;
private Subject subject;