in core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/PropertiesLoginModule.java [84:151]
public boolean login() throws LoginException {
File f = new File(baseDir, usersFile);
InputStream fis = null;
try {
fis = new java.io.FileInputStream(f);
users.load(fis);
} catch (IOException ioe) {
throw new LoginException("Unable to load user properties file " + f);
} finally {
if (fis != null) {
try {
fis.close();
fis = null;
} catch (IOException e) {
throw new LoginException("Unable to close user properties file " + f);
}
}
}
f = new File(baseDir, groupsFile);
try {
fis = new java.io.FileInputStream(f);
groups.load(fis);
} catch (IOException ioe) {
throw new LoginException("Unable to load group properties file " + f);
} finally {
if (fis != null) {
try {
fis.close();
fis = null;
} catch (IOException e) {
throw new LoginException("Unable to close group properties file " + f);
}
}
}
Callback[] callbacks = new Callback[2];
callbacks[0] = new NameCallback("Username: ");
callbacks[1] = new PasswordCallback("Password: ", false);
try {
callbackHandler.handle(callbacks);
} catch (IOException ioe) {
throw new LoginException(ioe.getMessage());
} catch (UnsupportedCallbackException uce) {
throw new LoginException(uce.getMessage() + " not available to obtain information from user");
}
user = ((NameCallback) callbacks[0]).getName();
char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword();
if (tmpPassword == null) {
tmpPassword = new char[0];
}
String password = users.getProperty(user);
if (password == null) {
throw new FailedLoginException("User does not exist");
}
if (!password.equals(new String(tmpPassword))) {
throw new FailedLoginException("Password does not match");
}
users.clear();
if (debug) {
LOGGER.debug("login {}", user);
}
return true;
}