public static final String CMDUSER_PROPERTY = Globals.IMQ + ".imqcmd.user";
public static final String CMDUSER_PWD_PROPERTY = Globals.IMQ + ".imqcmd.password";
public static final String CMDUSER_SVC_PROPERTY = Globals.IMQ + ".imqcmd.service";
public static boolean authenticateCMDUserIfset() {
BrokerConfig bcfg = Globals.getConfig();
String cmduser = bcfg.getProperty(CMDUSER_PROPERTY);
if (cmduser == null) return true;
Logger logger = Globals.getLogger();
BrokerResources rb = Globals.getBrokerResources();
if (cmduser.trim().length() == 0) {
logger.log(Logger.FORCE, rb.X_BAD_PROPERTY_VALUE,
CMDUSER_PROPERTY+ "=" + cmduser);
return false;
}
/*
if (!bcfg.getBooleanProperty(Globals.KEYSTORE_USE_PASSFILE_PROP)) {
logger.log(Logger.FORCE, rb.E_AUTH_CMDUSER_PASSFILE_NOT_ENABLED,
Globals.KEYSTORE_USE_PASSFILE_PROP, cmduserProp);
return false;
}
*/
String cmdpwd = bcfg.getProperty(CMDUSER_PWD_PROPERTY);
if (cmdpwd == null) {
logger.log(Logger.FORCE, rb.X_PASSWORD_NOT_PROVIDED,
CMDUSER_PROPERTY+"="+cmduser);
return false;
}
String cmdsvc = bcfg.getProperty(CMDUSER_SVC_PROPERTY);
if (cmdsvc == null) cmdsvc = "admin";
List activesvcs= ServiceManager.getAllActiveServiceNames();
if (activesvcs == null || !activesvcs.contains(cmdsvc)) {
logger.log(Logger.FORCE, rb.E_NOT_ACTIVE_SERVICE, cmdsvc,
CMDUSER_PROPERTY+"="+cmduser);