String credentials = st.nextToken();
String userPass = new String(Base64.decodeBase64(credentials.getBytes()));
int p = userPass.indexOf(":");
if (p != -1) {
userID = userPass.substring(0, p);
UserData user = mRoller.getUserManager().getUserByUsername(userID);
boolean enabled = user.getEnabled().booleanValue();
if (enabled) {
// are passwords encrypted?
RollerContext rollerContext =
RollerContext.getRollerContext();
String encrypted =
RollerConfig.getProperty("passwds.encryption.enabled");
password = userPass.substring(p+1);
if ("true".equalsIgnoreCase(encrypted)) {
password = Utilities.encodePassword(password,
RollerConfig.getProperty("passwds.encryption.algorithm"));
}
valid = user.getPassword().equals(password);
}
}
}
}
}