use of com.emc.storageos.systemservices.impl.util.LocalPasswordHandler in project coprhd-controller by CoprHD.
the class PasswordServiceTest method testUpdateUserPasswordEmptyParams.
@Test(expected = BadRequestException.class)
public void testUpdateUserPasswordEmptyParams() {
PasswordService passwordResource = new PasswordService();
passwordResource.setPropertiesMetadata(_propertiesMetadata);
passwordResource.setAuditLogManager(new DummyAuditLogManager());
PasswordResetParam passwordUpdate = getDummyPasswordReset(LOCAL_ROOT, "", "");
LocalPasswordHandler ph = getPasswordHandler();
ph.setLocalUsers(createLocalUsers());
passwordResource.setPasswordHandler(ph);
SecurityContext sc = new DummySecurityContext(LOCAL_ROOT);
passwordResource.setSecurityContext(sc);
Response res = passwordResource.updateUserPassword(passwordUpdate, false);
}
use of com.emc.storageos.systemservices.impl.util.LocalPasswordHandler in project coprhd-controller by CoprHD.
the class PasswordServiceTest method testUpdateUserPassword.
@Test
public void testUpdateUserPassword() {
PasswordService passwordResource = new PasswordService();
passwordResource.setPropertiesMetadata(_propertiesMetadata);
passwordResource.setAuditLogManager(new DummyAuditLogManager());
PasswordResetParam passwordUpdate = getDummyPasswordReset(LOCAL_ROOT, "!changeMe3", "");
LocalPasswordHandler ph = getDummyLocalPasswordHandler();
ph.setLocalUsers(createLocalUsers());
passwordResource.setPasswordHandler(ph);
SecurityContext sc = new DummySecurityContext(LOCAL_ROOT);
passwordResource.setSecurityContext(sc);
Response res = passwordResource.updateUserPassword(passwordUpdate, false);
int statusCode = res.getStatus();
Assert.assertTrue("updatePassword failed with code " + statusCode + ": " + res.getEntity().toString(), statusCode == Status.OK.getStatusCode());
sc = new DummySecurityContext(LOCAL_PROXYUSER);
passwordResource.setSecurityContext(sc);
passwordUpdate.setUsername(LOCAL_PROXYUSER);
res = passwordResource.updateUserPassword(passwordUpdate, false);
statusCode = res.getStatus();
Assert.assertTrue("updatePassword failed with code " + statusCode + ": " + res.getEntity().toString(), statusCode == Status.OK.getStatusCode());
}
use of com.emc.storageos.systemservices.impl.util.LocalPasswordHandler in project coprhd-controller by CoprHD.
the class PasswordServiceTest method getPasswordHandler.
public LocalPasswordHandler getPasswordHandler() {
LocalPasswordHandler ph = new LocalPasswordHandler();
initPasswordHandler(ph);
return ph;
}
use of com.emc.storageos.systemservices.impl.util.LocalPasswordHandler in project coprhd-controller by CoprHD.
the class LocalPasswordHandlerTest method testSetAndVerifyUserPassword.
@Test
public void testSetAndVerifyUserPassword() throws Exception {
// NOSONAR ("squid:S2068 Suppressing sonar violation of hard-coded password")
String newPassword = "newPassword123";
LocalPasswordHandler ph = getPasswordHandler();
changeAndVerifyUserPassword(LOCAL_ROOT, newPassword, "hashed", ph);
changeAndVerifyUserPassword(LOCAL_SYSMON, newPassword, "hashed", ph);
changeAndVerifyUserPassword(LOCAL_PROXYUSER, newPassword, "encrypted", ph);
}
use of com.emc.storageos.systemservices.impl.util.LocalPasswordHandler in project coprhd-controller by CoprHD.
the class LocalPasswordHandlerTest method testCheckUserExists.
@Test
public void testCheckUserExists() {
LocalPasswordHandler ph = getPasswordHandler();
ph.setLocalUsers(createLocalUsers());
Assert.assertTrue(ph.checkUserExists(LOCAL_ROOT));
Assert.assertTrue(ph.checkUserExists(LOCAL_SYSMON));
Assert.assertTrue(ph.checkUserExists(LOCAL_PROXYUSER));
Assert.assertFalse(ph.checkUserExists("fakeuser"));
}
Aggregations