use of com.emc.storageos.model.property.PropertyInfoUpdate in project coprhd-controller by CoprHD.
the class PasswordPolicyConfigTest method setViprProperty.
private void setViprProperty(String name, String value) throws Exception {
waitForClusterStable();
Map<String, String> properties = new HashMap<String, String>();
properties.put(name, value);
PropertyInfoUpdate propertyInfoUpdate = new PropertyInfoUpdate();
propertyInfoUpdate.setProperties(properties);
systemClient.config().setProperties(propertyInfoUpdate);
}
use of com.emc.storageos.model.property.PropertyInfoUpdate in project coprhd-controller by CoprHD.
the class LocalPasswordHandler method updateUserPasswordProperty.
/**
* when updating localuser's encpassword property, this method should be call instead of
* updateProperty method.
*
* it will update encpassword property, it also update user's expiry_date property and
* user's password history.
*
* expiry_date system properties is for generate /etc/shadow file to block ssh login after
* user's password expired.
*
* @param username
* @param value
* @throws CoordinatorClientException
* @throws LocalRepositoryException
*/
private void updateUserPasswordProperty(String username, String value, boolean bReset) throws CoordinatorClientException, LocalRepositoryException {
String encpasswordProperty = String.format(SYSTEM_ENCPASSWORD_FORMAT, username);
PropertyInfoUpdate props = new PropertyInfoUpdate();
props.addProperty(encpasswordProperty, value);
Calendar newExpireTime = getExpireTimeFromNow();
if (username.equals("root") || username.equals("svcuser")) {
// add expiry_date system property
String configExpireDays = getPasswordUtils().getConfigProperty(Constants.PASSWORD_EXPIRE_DAYS);
int intConfigExpireDays = NumberUtils.toInt(configExpireDays);
int daysAfterEpoch = 0;
if (intConfigExpireDays != 0) {
daysAfterEpoch = PasswordUtils.getDaysAfterEpoch(newExpireTime);
}
String expirydaysProperty = String.format(Constants.SYSTEM_PASSWORD_EXPIRY_FORMAT, username);
_log.info("updating " + expirydaysProperty + " to " + daysAfterEpoch);
props.addProperty(expirydaysProperty, String.valueOf(daysAfterEpoch));
}
try {
_cfg.setProperties(props);
if (username.equals("proxyuser")) {
value = _passwordUtils.getEncryptedString(value);
}
_passwordUtils.updatePasswordHistory(username, value, newExpireTime, bReset);
} catch (Exception e) {
throw APIException.internalServerErrors.updateObjectError("properties", e);
}
}
use of com.emc.storageos.model.property.PropertyInfoUpdate in project coprhd-controller by CoprHD.
the class LocalPasswordHandler method updateProperty.
public void updateProperty(String key, String value) throws CoordinatorClientException, LocalRepositoryException {
PropertyInfoUpdate props = new PropertyInfoUpdate();
props.addProperty(key, value);
_log.info("Calling ConfigService to update property: ", key);
try {
_cfg.setProperties(props);
} catch (Exception e) {
throw APIException.internalServerErrors.updateObjectError("properties", e);
}
}
use of com.emc.storageos.model.property.PropertyInfoUpdate in project coprhd-controller by CoprHD.
the class ConfigServiceTest method testEmailUsingAuthWithNoUsernamePassword.
@Test
public void testEmailUsingAuthWithNoUsernamePassword() {
ConnectEmcEmail email = new ConnectEmcEmail();
email.setEmailSender("DONOTREPLY@customer.com");
email.setEmailServer("mailhub.lss.emc.com");
email.setNotifyEmailAddress("joe.customer@customer.com");
email.setPrimaryEmailAddress("emailalertesg@emc.com");
email.setSafeEncryption("no");
email.setSmtpAuthType("login");
PropertyInfoUpdate propInfo = null;
try {
propInfo = ConfigService.ConfigureConnectEmc.configureEmail(email);
} catch (Exception e) {
Assert.assertNull(propInfo);
return;
}
Assert.fail();
}
use of com.emc.storageos.model.property.PropertyInfoUpdate in project coprhd-controller by CoprHD.
the class ConfigServiceTest method testEmailUsingNoAuth.
@Test
public void testEmailUsingNoAuth() {
ConnectEmcEmail email = new ConnectEmcEmail();
email.setEmailSender("DONOTREPLY@customer.com");
email.setEmailServer("mailhub.lss.emc.com");
email.setNotifyEmailAddress("joe.customer@customer.com");
email.setPrimaryEmailAddress("emailalertesg@emc.com");
email.setSafeEncryption("no");
email.setStartTls("no");
PropertyInfoUpdate propInfo = ConfigService.ConfigureConnectEmc.configureEmail(email);
Assert.assertEquals(propInfo.getProperty("system_connectemc_smtp_server"), email.getEmailServer());
Assert.assertEquals(propInfo.getProperty("system_connectemc_smtp_emcto"), email.getPrimaryEmailAddress());
Assert.assertEquals(propInfo.getProperty("system_connectemc_smtp_from"), email.getEmailSender());
Assert.assertEquals(propInfo.getProperty("system_connectemc_smtp_to"), email.getNotifyEmailAddress());
Assert.assertEquals(propInfo.getProperty("system_connectemc_smtp_enabletls"), email.getStartTls());
Assert.assertEquals(propInfo.getProperty("system_connectemc_encrypt"), email.getSafeEncryption());
Assert.assertNull(propInfo.getProperty("system_connectemc_smtp_authtype"));
Assert.assertNull(propInfo.getProperty("system_connectemc_smtp_username"));
Assert.assertNull(propInfo.getProperty("system_connectemc_smtp_password"));
}
Aggregations