use of com.emc.storageos.systemservices.impl.util.LocalPasswordHandler in project coprhd-controller by CoprHD.
the class LocalPasswordHandlerTestBase method getPasswordHandler.
public LocalPasswordHandler getPasswordHandler() {
PasswordUtils.setDefaultProperties(new Properties());
PasswordUtils utils = new PasswordUtils();
utils.setCoordinator(new StubCoordinatorClientImpl(URI.create("urn:coordinator")));
utils.setDbClient(new DummyDbClient());
LocalPasswordHandler ph = new LocalPasswordHandler();
ph.setConfigService(_cfg);
ph.setPasswordUtils(utils);
return ph;
}
use of com.emc.storageos.systemservices.impl.util.LocalPasswordHandler in project coprhd-controller by CoprHD.
the class PasswordServiceTest method testUpdatePasswordEmptyParams.
@Test(expected = BadRequestException.class)
public void testUpdatePasswordEmptyParams() {
PasswordService passwordResource = new PasswordService();
passwordResource.setPropertiesMetadata(_propertiesMetadata);
passwordResource.setAuditLogManager(new DummyAuditLogManager());
PasswordUpdateParam passwordUpdate = getDummyPasswordUpdate("", "");
LocalPasswordHandler ph = getPasswordHandler();
ph.setLocalUsers(createLocalUsers());
passwordResource.setPasswordHandler(ph);
SecurityContext sc = new DummySecurityContext(LOCAL_ROOT);
passwordResource.setSecurityContext(sc);
Response res = passwordResource.updatePassword(null, null, passwordUpdate, false);
}
use of com.emc.storageos.systemservices.impl.util.LocalPasswordHandler in project coprhd-controller by CoprHD.
the class PasswordServiceTest method testUpdatePasswordNoSecurityContext.
@Test(expected = ForbiddenException.class)
public void testUpdatePasswordNoSecurityContext() {
PasswordService passwordResource = new PasswordService();
passwordResource.setPropertiesMetadata(_propertiesMetadata);
passwordResource.setAuditLogManager(new DummyAuditLogManager());
PasswordUpdateParam passwordUpdate = getDummyPasswordUpdate("!changeme", null);
LocalPasswordHandler ph = getPasswordHandler();
passwordResource.setPasswordHandler(ph);
Response res = passwordResource.updatePassword(null, null, passwordUpdate, false);
res.getStatus();
}
use of com.emc.storageos.systemservices.impl.util.LocalPasswordHandler 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.systemservices.impl.util.LocalPasswordHandler in project coprhd-controller by CoprHD.
the class PasswordServiceTest method testUpdateSamePassword.
@Test(expected = BadRequestException.class)
public void testUpdateSamePassword() {
PasswordService passwordResource = new PasswordService();
passwordResource.setPropertiesMetadata(_propertiesMetadata);
passwordResource.setAuditLogManager(new DummyAuditLogManager());
PasswordUpdateParam passwordUpdate = getDummyPasswordUpdate("ChangeMe", null);
LocalPasswordHandler ph = new DummyLocalPasswordHandler();
ph.setLocalUsers(createLocalUsers());
passwordResource.setPasswordHandler(ph);
SecurityContext sc = new DummySecurityContext(LOCAL_ROOT);
passwordResource.setSecurityContext(sc);
// The following should fail with exception
Response res = passwordResource.updatePassword(null, null, passwordUpdate, false);
}
Aggregations