use of com.emc.storageos.model.password.PasswordResetParam in project coprhd-controller by CoprHD.
the class PasswordServiceTest method testUpdateUserPasswordNoSecurtyContext.
@Test(expected = ForbiddenException.class)
public void testUpdateUserPasswordNoSecurtyContext() {
PasswordService passwordResource = new PasswordService();
passwordResource.setPropertiesMetadata(_propertiesMetadata);
passwordResource.setAuditLogManager(new DummyAuditLogManager());
PasswordResetParam passwordUpdate = getDummyPasswordReset("user123", "!changeme", "");
Response res = passwordResource.updateUserPassword(passwordUpdate, false);
Assert.assertTrue("Should throw exception, but returned " + res.getStatus(), false);
}
use of com.emc.storageos.model.password.PasswordResetParam in project coprhd-controller by CoprHD.
the class PasswordServiceTest method getDummyPasswordReset.
public PasswordResetParam getDummyPasswordReset(String username, String password, String encpassword) {
PasswordResetParam passwordUpdate = new PasswordResetParam();
passwordUpdate.setUsername(username);
passwordUpdate.setPassword(password);
passwordUpdate.setEncPassword(encpassword);
return passwordUpdate;
}
use of com.emc.storageos.model.password.PasswordResetParam in project coprhd-controller by CoprHD.
the class PasswordServiceTest method testUpdateUserPasswordTooManyParams.
@Test(expected = BadRequestException.class)
public void testUpdateUserPasswordTooManyParams() {
PasswordService passwordResource = new PasswordService();
passwordResource.setPropertiesMetadata(_propertiesMetadata);
passwordResource.setAuditLogManager(new DummyAuditLogManager());
PasswordResetParam passwordUpdate = getDummyPasswordReset(LOCAL_ROOT, "clearTextPwd", "HashedPassword");
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.model.password.PasswordResetParam in project coprhd-controller by CoprHD.
the class PasswordServiceTest method testUpdateUserPasswordNonExistingUser.
@Test(expected = BadRequestException.class)
public void testUpdateUserPasswordNonExistingUser() {
PasswordService passwordResource = new PasswordService();
passwordResource.setPropertiesMetadata(_propertiesMetadata);
passwordResource.setAuditLogManager(new DummyAuditLogManager());
PasswordResetParam passwordUpdate = getDummyPasswordReset("user123", "!changeme", "");
LocalPasswordHandler ph = getDummyLocalPasswordHandler();
ph.setLocalUsers(createLocalUsers());
passwordResource.setPasswordHandler(ph);
SecurityContext sc = new DummySecurityContext("root");
passwordResource.setSecurityContext(sc);
Response res = passwordResource.updateUserPassword(passwordUpdate, false);
}
use of com.emc.storageos.model.password.PasswordResetParam in project coprhd-controller by CoprHD.
the class PasswordServiceTest method testUpdateUserPasswordNoPrincipal.
@Test(expected = ForbiddenException.class)
public void testUpdateUserPasswordNoPrincipal() {
PasswordService passwordResource = new PasswordService();
passwordResource.setPropertiesMetadata(_propertiesMetadata);
passwordResource.setAuditLogManager(new DummyAuditLogManager());
PasswordResetParam passwordUpdate = getDummyPasswordReset("user123", "!changeme", "");
SecurityContext sc = new DummySecurityContext("noprincipal");
passwordResource.setSecurityContext(sc);
Response res = passwordResource.updateUserPassword(passwordUpdate, false);
Assert.assertTrue("Should throw exception, but returned " + res.getStatus(), false);
}
Aggregations